SoFunction
Updated on 2025-03-10

Chat Web Picture Server Application Analysis

Just one's own understanding, so as to attract more valuable information.

Related to the storage of pictures
What medium do you want to store images? If you have enough funds to purchase dedicated image server hardware or NAS equipment, it is very simple; if you have the ability to develop a file system that stores images separately, you don’t have to continue reading.

If the above conditions are not met and you just want to store them on an ordinary hard disk, you must first consider the actual processing capabilities of the physical hard disk. Whether it is 7200 or 15000, the actual performance varies greatly. Should I choose ReiserFS or Ext3? Is it necessary to test it? When creating a file system, the Inode issue should also be considered. Choose the appropriate size of inode size, make choices in space and speed, and prevent problems before they happen. Pay attention to the limit of the number of files in a single file system.

Independent, standalone server
Whether in terms of management or performance, try to deploy an independent image server as much as possible. This has almost become common sense (but I have been laughed at about this issue before I did a web-oriented project). After having an independent image server or server cluster, targeted configuration optimization can be carried out on the Web server. For example, use the legendary more efficient Lighttpd.

If you don't want to synchronize all pictures between several machines, just use NFS mode to share it. Pay attention to the possible problems caused by soft and hard connections, as well as the specific transmission speed of NFS.

Independent, independent domain name
If most web pages must load many pictures, then you need to pay attention to the number of connections in the IE browser (see test of this problem).

A few days ago, a friend asked me online, "Why do some large websites use another domain name? For example, the image server uses a domain name?", a rough answer: In addition to the convenience of management and the convenience of CDN synchronization processing, the IE connection limit mentioned above is also a consideration (I don't know other reasons, please invite Yahoo!'s classmate to speak) [There is another factor that I didn't consider is the cookie factor, and I participated in Gao Chunhui's message downstairs]

Yahoo Web Optimization 14 items
Regarding the 14 rules of optimization advocated by Yahoo YSlow tools, it is recommended that every Web maintenance worker must memorize it, and of course it should also look at it dialectically - the page introducing these 14 rules can only get more than 70 points... There are some contradictions between the ninth item and the independent domain name mentioned above. The actual situation must be determined based on your Benchmark and specific needs.

Effectively utilize client Cache
In order to achieve certain visual effects, many website UI designers will apply a large number of pictures on page modules that users need to frequently access. In this case, research shows that for sites with relatively high user viscosity, it is very necessary to set Expires Header for this type of object on the Web server. A large amount of bandwidth is saved in this way and the cost is also saved. By the way, for things like verification codes, you need to add a simple rule to filter them out.

Server-side Cache
in the country, CDN can only afford to play with money. Package storage services like Amazon S3 have not yet appeared in China. Therefore, it is also necessary to make full use of the server-side cache. As a reverse proxy server, the buffering image effect should be said to be acceptable. According to evaluation, Ncache contributed by Sina's technical team, the effect is better.

High-resolution picture problems
If the website has a large number of high-resolution images, it is necessary to consider deploying IIPImage or similar software.

Operational issues
Many relatively large-scale websites do not process any pictures uploaded by users, and as a result, you can see many BMP-format pictures on the page (I personally think it is shameful to have any BMP-format pictures on any website).... This is a complete mistake in operational strategy. Find a programmer to invest a little time to write an image processing module and convert those pictures obtained by "screenshots". The investment cost may be much smaller than the storage overhead. If the user accesses the image again, the quality may not be lost, and the browsing speed will undoubtedly be much better. Which method of handling is more acceptable is self-evident.