Hello everyone,
I've spent the past few months figuring out Drupal and I've come a long way I think. I recently set up a site with about roughly 70 modules. It's supposed to be very interactive and I hope to get a lot of logged in users, with groups, forums, etc. By the time I tested it on a live server, I realized the site was actually a bit slow. Along with that I was getting constant complaints from my host. I moved it to a VPS with about 550MB Ram, and though I rarely seem to hit the limit, there are brief (like a few minutes) 'spikes', said spikes result in a warning from my host, and occasionally what looks like a server restart that cripples my site for about ten minutes.
But that's the host. Outside of that, the site takes a while to load. It's not sooo bad yet, but when I compare it to the almost instant loading of other sites, I know it's noticeable, and I know once I got live that will be a problem. So here's the thing. I've done the usual compression and Drupal caching, but I've been looking at installing 3rd party modules like Boost and Authcache ahead of traffic increase, but I'm not getting the answers I want. It seems like the extra caching will eat further into my memory usage and I was wondering what to do because upping my memory is a cost I can't handle just yet, and it doesn't seem like caching will help me keep it at its current level.
So is the only middle ground to disable modules?
Looking for help. I've read a lot of discussions on here and I'll admit all the server talk is not my strong area.. at all. I'm a web designer with a site idea so if someone could break down the best route, I'd be grateful. If my only choice is to increase my VPS memory, I'd like to know too.
Thanks.
Comments
RAM is only one (small) part of the equation
Your RAM is probably a little low for running your own LAMP server and D7 with 70+ modules. I would suggest at least 1 GB, especially with registered users, OG, etc.
That having been said, you need to start thinking about tuning your server(s), caching, and general optimization. You can start by posting any details you want on the following items:
Check to make sure you do not include any site specific info. We do not need to see your directory structure for example.
Thanks
Thanks for the reply. Ah I thought as much. I guess I was hoping I could work around that haha. Okay.
Regarding the other things, i.e tuning the servers, well, I don't know, maybe you can tell me where to start tweaking :)
Like I said, I was looking at Boost and Authcache/Memcache since they've been recommended a lot, and I plan to have a lot of logged in traffic, but beyond that I'm not sure where else to configure and why.
When I first started having memory issues, and I moved to the VPS, my host told me I can edit stuff in the 'shell'. I use Windows, so I had to get some 3rd part software and I can login to the shell fine. If there's anything to do from there, I think I can handle it if given the right instructions.
My php.ini, the only thing I did there was change the memory limit to 256M. Everything else, I'm open to suggestions.
Edit: Wait, do you mean I should post my current settings for those things you listed or..?
Focus on my.cnf first
I have found that the my.cnf file is critical. Even the slightest tweak can cause your memory requirements to explode and your D7 server to collapse.
Take a look at this thread:
http://groups.drupal.org/node/286233
The file is located at /etc/my.cnf in Centos 6. Make a backup and carefully try changing settings. If you have webmin installed it is easy to view your RAM usage, otherwise enter the command is "free -m".
Oh wow, that's a LOT. I'll go
Oh wow, that's a LOT. I'll go over it... even though I can already see I'm going to have a problem because I can't locate the cnf file. I use Dreamhost.
Hosted or VPS?
If you are using a shared hosting service (typically $5 or so a month), you cannot possibly run a 70+ module site and expect any reasonable performance, at least IMHO. Hosted accounts will deploy CPU throttling on a D7 site as soon as you start registering users, deploying OG, etc. This will effectively shut you down no matter how much optimization you deploy.
Do you have a dedicated or VPS? If so, you are responsible for installing/running your own LAMP server and can make these types of adjustments.
I'm using a VPS. I was
I'm using a VPS. I was formerly on shared hosting and couldn't get very far.
You are going to need to get SSH access
If you have a VPS, someone needs to be managing the LAMP servers, and usually that means "you". I suggest you either start by getting SSH access, or find someone else to run the "non-drupal" services that are critical.
I also recommend you not worry about caching for now. It is yet another complex topic. Start with managing the server.
Also, have you accounted for security of the server? IPtables or some other Firewall. Some hosting companies take care of this for you by placing the entire physical server behind a firewall.
Yes, I got SSH access. Though
Yes, I got SSH access. Though beyond the commands written in my host's wiki, im not sure what to do with it.
It's looking a lot like this topic is beyond me. Coding I do and can do, this is a whole new thing. :/
edit: My host says I can only edit the my.cnf file if I have a dedicated server, is that normal? Is there a way around it?
Here is my checklist
I have faced the same problem on one of my VPS' on Rackspace. The problem got wors by the day so I moved from 256 to 512 to 1GB and today for two Drupal sites I am cranking a 2GB server. With each server resize the problem gets worse. Hosttracker reports atleast a one second downtime everyday! Over the last two and half years I have evolved a checklist (its on googledocs) so let me know if you need it. Reproducing the salient points here to ease the pain.
Apache is bandwidth limited, PHP is CPU limited, and MySQL is memory limited
top
ps -aux
netstat -anp | sort -u
Best regards,
Sridhar Pandurangiah
Ok, thank you. I've done some
Ok, thank you. I've done some of these things, like the JS and YSlow, and Boost. Also the bots. I heard Google was hitting my site hard sometimes, but I couldn't figure out how to check that, so I stopped it, but then I was getting proper indexing, and then I had to re-enable.
Boost did wonders for the pages on anon, but it's still just me looking at it.
The things you listed in no 3, I do it from SSH right? I can handle that. Though the question now becomes, once I discover the bottlenecks what next.
Always start with tuning
Always start with tuning MySQL, because the settings in my.cnf determine how much RAM it will use; MySQL will happily use all the RAM you give it. Large index tables and query caching will speed up your database, but will also take a lot of RAM.
With that little RAM, you should definitely tune Apache as well, make sure that there are only few CGI processes available at a time (MaxServers and MaxClients). With Drupal 7, a typical CGI process will take up to 100-150MB (depending on your configuration and modules), meaning 4-5 processes will already use all your RAM. The fewer processes, the more available RAM per process. It may or may not slow down your site, but at least you will prevent using SWAP (bad) and not run out of RAM (worse).
APC is a must, always. A side-note is that with FCGI, APC will not be shared though processes. I would revert to PHP-FPM.
Only if you have more RAM available, I would start considering extra services, such as Memcached.
Sridhar also mentions a bunch of frontend optimizations, many researches show that that is where the best results can be achieved (read up on Planet Performance for more info), so I would definitely do some optimization there.
Alright, I've sent a support
Alright, I've sent a support ticket to my host because I can't locate this cnf file.
Any suggestions on how I tune Apache? Sorry for all the questions, like I said, this is a new area to me.
APC, I've seen this one around, I'll look into it thanks.
My host says I can only edit
My host says I can only edit the my.cnf file if I have a dedicated server, is that normal? Is there a way around it?
I just use Barracuda-Aegir
I just use Barracuda-Aegir (BOA) for all my VPSs now (I do aim for no less than 2G RAM on production). It uses Nginx (faster than apache), MariaDB (optimized version of MySQL that drupal.org also uses), memcached, its own version of boost, and of course firewall and other goodies and reasonable preconfigured defaults. It took some getting used to but it's totally worth it. I'm not a sysadmin so I'm happy to use what other folks have already tried and tested.
-Natalie
Friendlydrupal.com - Drupal Video Tutorials
BOA (Barracuda+Octopus+Aegir) or Pantheon
If you want to run your own server I can second BOA (Barracuda+Octopus+Aegir) for setting it up. I use it on my own server. It gives you a great starting point so far as performance optimization and security goes. You can find it at http://drupal.org/project/barracuda
But if you are just going to have a single site, the Pantheon service (mentioned below) is also a good option. They take care of the server stuff and let you concentrate on your drupal site. Its also great for sites that might have spikes since it can expand to handle the traffic.
Good luck
Thanks everyone for all the
Thanks everyone for all the advice. This is definitely not as easy as I thought it was going to be ha. Everyone says I should tune Apache and MySQL so I'm going to start there.
Use Pantheon
Hi there,
As much as I am a fan of educating and learning (for example my session here, talks about this: http://munich2012.drupal.org/program/sessions/4x-high-performance-drupal...) if you really want to go live within a reasonable time frame, I would suggest you to use a Drupal hosted service.
are the easiest coming to mind right now. They are performance optimized and give you an "edge" start.
For Pantheon you will want to contact them though to give you Redis access and install the redis module. For Acquia Cloud you want to use Memcache.
If you have time, want to learn and want to keep on the VPS route, I would encourage you to use a Provider that offers you more memory. A german one I personally use and am very very happy with is: "https://www.ip-projects.de/vserver-V-Server%20XL.html" with 4GB for around 30 $ per month. You might need to use Google Translate though. I am not affiliated with them, I just love their service. There are of course other VPS with more memory you can use, but I don't know them.
I hope that helps and happy optimizing!
How many sites with database
How many sites with database access to mysql are on this server?