3

Yes, I have read many close questions, but I needed a specific answer and hence this question.

First, these are my new server specifications: Linux Server (CentOS), Intel Xeon 3470 Quad Core (2.93GHz x 4) processor, 4 GB DDR3 Memory, 1TB Hard Disk Space, 10 TB Bandwidth and 9 Dedicated IPs.

AIM: To speed up my wordpress blog + Increase server's capacity to handle heavy load

PLAN: This is how I am planning to setup my server - - VARNISH (in the front, to cache server responses) >> NGINX (to effectively handle static content & overcome the C10k problem) >> APACHE (behind Nginx, to effectively deliver dynamic content) >> APC (PHP page, database & object caching) >> CPANEL (which requires Apache, and I require it) >> WORDPRESS >> W3 TOTAL CACHE (caching plugin for Wordpress).

So , will the setup work? Have anyone tried it? Please shower your thoughts and knowledge.

NOTE: I can't do without Apache because I am used to that .htaccess & Cpanel stuff. So, it's not any option. All others are options. Please try to help.

I hope I am clear in what I wanted to ask.

2 Answers2

1

This looks like a classic case of premature optimization. Are you currently having capacity problems with Wordpress? I would start with a simpler setup of just Apache, APC, and Wordpress and see what you need. If you aren't hitting the C10K problem there is no need to solve it at this time. If you aren't serving a large amount of static content, you probably don't need to setup Varnish.

slillibri
  • 1,643
  • 1
  • 9
  • 8
  • @slillibri I just want to make sure, my server doesn't go down due to traffic spikes. –  Jun 25 '11 at 01:50
  • @slillibri Would this be a better idea? Nginx, Apache, APC & Wordpress, and then a CDN to serve the static files (instead of Varnish). Howz that? –  Jun 25 '11 at 01:52
  • @Aahan Still a bit of premature optimization. Setup the basics and do some load testing with ab or httperf or Tsung. Before you have some numbers I would stick to a simple, easy to debug setup. It takes a minute to get a CDN setup for your site, and even then it's more to speed delivery of static assets globally. – slillibri Jun 25 '11 at 02:09
  • @slillibri Thanks for your suggestion. Yes, I am starting to consider them now. –  Jun 25 '11 at 03:16
  • @slillibri Finally I have decided upon this: VARNISH in front of APACHE + WORDPRESS + CDN. 1. Since I am using Varnish, I don't need a cache plugin for wordpress, like W3 Total Cache right? 2. And since I will be using a CDN it reduces the need for Nginx / Cherokee or whatever, right? Please shower your thoughts about this setup. –  Jun 25 '11 at 16:16
  • I'm not too experienced with Wordpress, but Varnish won't cache much by default, due to Wordpress setting cookies and things like badly configured Cache-Control headers from apps. Make sure Wordpress is configured to serve content with the correct headers set, and configure Varnish and Wordpress to cache as much as possible. Tons of tutorials about that. – Martijn Heemels Jun 25 '11 at 22:16
  • @MartijnHeemels `"configure Varnish and Wordpress to cache as much as possible. Tons of tutorials about that."` It would be great if you can share a few good links that you know. –  Jun 26 '11 at 04:21
1

You don't need NGINX to do the static content. Varnish solves the C10K problem as well. So you can just do varnish -> apache w/ mod_php and APC

W3TC configured to use APC for PHP object and Database cache will work fine.

You should also setup W3TC to offload static content (js, css, images, media) to a subdomain, and then consider making that subdomain a CNAME to a CDN instead of just a second hostname pointing to Varnish.

Varnish cache, and W3TC cache are different, W3TC can cache database queries, and stuff like that, sub-parts of the page, whereas Varnish is caching the entire object (page, image). So you still want W3TC. Varnish won't cache anything with cookies, so make sure you strip cookies on images/js/css (except captchas, etc).

Allan Jude
  • 1,286
  • 9
  • 13
  • I need some clarification about the last point. — As far as I know, W3 Total Cache caches Pages, objects and database; furthermore, it minifies HTML, CSS and JS; enables browser cache and adds necessary headers — And then, you said `"whereas Varnish is caching the entire object (page, image)"` — Can you please clarify what exactly Varnish caches? It caches pages, serves static content (images, JS, CSS etc) quickly... is that right? And what does does it do? –  Jun 26 '11 at 04:49
  • W3TC is very configurable. You can tell it specifically what to do, what not to do. e.g. I use mod_pagespeed, so I tell W3TC not to minify or compress. W3TC has a section where you can set up its interaction with Varnish! Let me know how you get along as I am considering a similar stack. – OC2PS Oct 30 '12 at 06:49