We have news portal. We have 5 identical dedicated boxes. 2xE5620, 16GB ram, 4x146gb 15k sas raid10. at this time bottleneck is mysql.

One box is load balancer (nginx), two boxes (C,D) is nginx & phpfpm, one is mysql backup and one box is mysql.

At this moment caching is on box C and D. we use memcached, where are stored result from mysql. Sometimes in page is white boxes (no content loaded). I already made atomic inserts into memcached and made full debugging of memcached operations.

So, i think that maybe must made static files. When new article is published, then create static html file for it and use server side includes for comment count displaying and same comment content displaying. Then nginx can cache mostly used files and serve them from memory. With static pages we could also speed up page loading time.

I am thinking about cookie less domain, but i am not sure if that helps, because network pipe not bottleneck.

Question is: what caching system/model to use?

  • After reading this I'm still not sure what specifically you need an answer to. Perhaps you could elaborate, including some options you are considering. Mar 4 '12 at 15:18
  • 1
    Sounds like some pretty powerful boxen you've got there; have you profile your queries to ensure you're not pounding the DB needlessly?
    – Chris S
    Mar 4 '12 at 15:50
  • I am actually server administrator. I am not developing same application. Maybe i need just tell app developers to profile and optimize sql querys. At this time page is running fine, but when in page is about 2000 users, then traffic between mysql and web server is bottleneck. We can connect mysql server to switch with both network cards and configure to each box is connecting to individual nic. And also i think thad boxes can handle more than 2000 users online... thats because i want to make static pages, to minimize sql load.
    – Guntis
    Mar 4 '12 at 20:42

nginx has inbuilt caching for both proxies and FastCGI. With your set-up, you could choose either to use the proxy cache on the load balancer box, or the FastCGI cache on the backend web servers.

One gotcha: you need to make sure you don't cache hits that contain private or user-specific information and then serve them to other people, so make use of proxy_no_cache or fastcgi_no_cache and use location blocks to exclude your admin and dynamic-only areas.

Depending on your users, they might become frustrated or try again if comment pages are cached and they don't see their comment immediately, so if you cache comment pages you should add a notice that they may take a few minutes to appear (or however long you tell nginx to cache it).

This all assumes you're generating the exact same HTML for a lot of your visitors (which would normally be the case for a news portal, unless you do per-user customisation or in-server ad rotation). If a significant proportion of your hits are generating unique pages, then you might find it better in the short term to modify your architecture to swap the load balancer for round-robin DNS and an extra MySQL read slave, assuming your load is read-heavy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.