ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

SQL queries and memory usage - what's my ballpark?

May 10, 2011 5:23am

Subscribe [3]
  • #1 / May 10, 2011 5:23am

    demotive

    8 posts

    Hi everyone,

    Okay, this is a bit of a newbie question. One of the sites I’ve built has been steadily increasing in traffic over time. Last month it was on 15k page views. Now I know that’s not enormous, but the site has started to run into hosting issues.

    Originally it was on a (v.cheap) shared server, and the number of queries was exceeding the maximum. So far so obvious.

    Now it sits on a VPS server, but there are still memory issues. The hosts claim 340mb ram and all the usual “unlimited bandwidth” etc.

    Now I know this isn’t great detail, but this is one of those posts where I’m trying to establish just where my goalposts are. What’s bothering me slightly is that I could possibly increase the efficiency of my EE install by stripping out certain features / reducing weblog queries and so on, but it might just be the case that my code is more or less fine and the issue is still with the server.

    So.

    • It’s EE 1.6.9
    • An average page page uses 81 queries
    • Memory Usage: 6,379,980 bytes
    • Connection is non-persistent
    • Enable SQL Query Caching is on
    • Templates are cached to 120mins
    • Templates using the built in hit tracking (“view”) use tag caching of 120 mins wherever possible
    • I’m using “disable” as much as I can

    As a measure, I’ve compared this to my own 1 page site, which has A LOT less going on in terms of weblog queries:

    • 15 queries
    • Memory Usage: 3,761,036 bytes
    • Connection is non-persistent
    • Enable SQL Query Caching is on
    • Templates are cached to 60mins
    • I’m using “disable” as much as I can

    So my basic question is: does the number of queries and memory usage in the first instance sound like a crazy amount, or am I still in the standard ballpark?

    It’s one of those cases where I want to be as sure as I can that there’s a real issue at my end before I start stripping away features and so on.

    Hope you guys can help!

  • #2 / May 10, 2011 10:01am

    handyman

    509 posts

    Are you able to telnet in and do a “top” or other command to look at the server load?

    My first guess is that the host is lacking - 15K pages per month should not START to tax any real VPS.

    Since this is a VPS, can the mysql conf file be modified. Maybe it is set for one of the smaller instances. This would be more clear if the top command, etc, could be run, as that would show (somewhat) where the load was coming from. PHP also can use a lot of memory. It is important that the proper modules in apache be running so php runs properly with apache.

    There is also usually a mysql log - which you or your ISP can look at….

    One thing for sure - until you 100% know where the problem is, I would not suggest stripping and tuning. Sure, you can slightly increase the efficiency of certain processes, but in my experience you usually cannot fix something which is not broken…that is, if the problem is not EE but the server and settings, tuning EE is only a stopgap, not a solution.

    It’s hard to compare actual numbers…one to another. But I have to wonder how many of these “VPS” servers your host is keeping on one machine. Just as a comparison, we could easily serve 500,000 pages per month in EE in our mid-level (dedicated) machine. Working backwards through that, if your VPS was one of 20 on one machine, you should be able to serve the number of pages you are discussing with ease.

    But out in the real world you run into issues such as who the other VPS owners are on the same machine…are they heavy users, etc.?

    It seems as if many hosts don’t quite get it when it comes to what they advertise and what they give…...just for comparison sake, I know a site which gets millions of visitors per year and was always hosted on a verio virtual server! It’s still quick, too!

    If I were shopping for a smaller server, I would consider engine hosting (they are tied in with EE)...and/or I would ask a LOT of questions….such as “How many virtual servers do you host on one machine?”, etc…...

    I am not an expert admin, but it would seem to me that a CMS like EE uses RAM and other resources whether or not you have a lot of traffic. That is, mysql and apache tend to load a lot of stuff into RAM in order to be more efficient and faster, and they are going to attempt to so that whether you have 500 pages views a day or 5,000.

    Note - if you have phpmyadmin installed on the server, you can look at the runtime information and get an idea whether the mysql settings are way off. You can also use mysql tuners of various types which can be downloaded (google mysql tuner)....this whole thing could be as simple as changing your cfg file.

  • #3 / May 10, 2011 10:07am

    demotive

    8 posts

    Hi Handyman -

    Wow! Thanks so much for the information. To be honest I’m far more the “design / front end dev who uses EE” than an admin, but there’s a lot here that I can look into with the hosting company.

    To be honest, I had the same kind of thoughts, that my coding isn’t necessarily the culprit here - and after doing some quick tweaks on my local install I’ve pretty much confirmed that.

    Back to the hosts!

    But once more, thanks so much for such a detailed response 😊

  • #4 / May 10, 2011 1:58pm

    Lisa Wess

    20502 posts

    Thanks, Craig!

    demotive - have you seen Troubleshooting Site Performance Issues?  That may help you out as well.

  • #5 / May 11, 2011 5:31am

    demotive

    8 posts

    Thanks Lisa - yeah I have checked the article out, and implemented as much as I can at the EE end.

    As I’m not by any means a sysadmin, I’ve punted Craig’s very helpful thoughts over to the client and his hosts to see what we can do server-side.

    Once again, many thanks to you both 😊

  • #6 / May 12, 2011 5:18pm

    Sue Crocker

    26054 posts

    Hi, demotive. Do you still require assistance, or can we close this particular thread?

  • #7 / May 13, 2011 4:03am

    demotive

    8 posts

    Hi Sue -

    I think we may as well close this thread - the help has been great, and I’ve got enough to be getting on with 😊

    Thanks all, closed!

  • #8 / May 13, 2011 4:06am

    Sue Crocker

    26054 posts

    Sounds great - If anything else comes up, please do let us know in a new thread..

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases