App Servers vs. Web Servers

I serve static content from Tomcat. Someone suggested moving the static content to a web server in order to optimize performance. How are web servers designed that makes them better at delivering static content?

2

Servers which are able to serve dynamic content may sometimes not be suited for static content. They may have an additional performance penalty because requests may have to pass through the parts which decide which handler should take care of the request, how the request should be filtered to check if the user has the rights to access the resource, what additional actions such as compression should be applied to the response, etc.

Therefore, servers which either have fewer features or were configured specifically to serve static content only may provide a slightly better performance.

This being said, servers such as Apache or IIS are very capable to serve both dynamic and static content at the same time very fast, so unless you have actually measured the difference and you actually serve thousands of requests per second, you shouldn’t care too much. Much more important, for instance, is the way you configured client-side caching of your static content.

A CDN, however, is generally a good idea, even for medium-sized websites (i.e. a few dozens to a few hundreds of requests per second.) In the same way, static content is often put on a different server not for performance reasons, but simply because of the lower cost (compare for instance the cost of Amazon’s CloudFront with Amazon AWS instances.)

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *