We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26334
    • 77 Posts
    We have max connections at 200, any recommendations as to what people run for moderate traffic sites?

    Note also accessing the mysql server is 3 other database applications:
    - Forums
    - classifieds
    - ad serving.

    All are php mysql applications.

    My system is currently running at about 50% CPU usage, 50% RAM usage and a load average around 2. mysql shows in top at sitting around 10%cpu and 3-4% memory.

    The box should be flying. When very few people are on it it does fly, but it is like trying to drag a stubborn donkey at the moment.
      • 30223
      • 1,010 Posts
      Seeing the error in the event log I think your most immediate problem may be the persistent mysql connections. This is a frequent cause of too many mysql connections errors. If I recall correctly MODx itself doesn’t by default use persistent connections but perhaps some plugin/snippet does?

      Anyway if you have access to php.ini you can try to disable persistent connections and see if that improves performance.

      [MySQL]
      ; Allow or prevent persistent links.
      mysql.allow_persistent=Off
        • 2690
        • 148 Posts
        Here are my two cents:

        Its all because of the Openads software, with 200k pviews a day your openads DB is probably around 20gb already and if you set everything up by their instructions you probably have a maintenance script running every hour or so - this kills the server.
        I had exactly the same problem.
        The solution, move openads and its DB to a separate machine.


        Aleks
          MODx Revo 2.0.6-pl (Traditional) | Apache 2.2.3 | PHP 5.2.14 | MySQL 5.0.77 | MAC OS 10.6.5 | FF 3.6/Chrome 9.0.5
          • 2092
          • 1 Posts
          Hi,

          Seeing the error in the event log I think your most immediate problem may be the persistent mysql connections. This is a frequent cause of too many mysql connections errors. If I recall correctly MODx itself doesn’t by default
          I agree here, the errors you see are most likely related to persistent mysql connections and the # of connections being maxed out. OpenX (the ad serving software) doesn’t use this by default, but you can check your setting in the OpenX admin panel’s Settings->Database settings
          You’ll want to check the settings of the other web-software being used, too

          Your hardware specs are quite good, so definitely tuning of the actual software (apache, mysql, php) being used is highly suggested. It can make a very large difference - MySQL settings often should change depend on the hardware available and how much of the available memory, etc, you want MySQL to use.
          Some OpenX suggestions: https://developer.openx.org/wiki/display/DOCS/Performance+Tuning
          See the Children of the page for other general tips, like server monitoring and MySQL tuning

          with 200k views a day your openads DB is probably around 20gb already and if you set everything up by their instructions you probably have a maintenance script running every hour or so - this kills the server.

          With this case it sounds like something was wrong. 20GB is way too large for a 200k/day site -- hourly Maintenance shouldn’t kill the server but anytime the DB is 20gb the maintenance script will take quite a while to run, as will most other tasks.
          I would suggest first to upgrade to the newest version of OpenX to ensure you have the newest bug fixes, including some which do help DB size, but also to follow the OpenX tuning tips above - a main setting is in the Statistics and Maintenance Settings page which lets you change how long raw statistics should be kept once they have been summarised -- if you lower this value then your database size can be much less.

          Hope this helps,
          Arlen Coupland
          OpenX
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Great! We love to see developers of third-party apps we’re using in MODx add their advice grin grin
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 26334
              • 77 Posts
              No, I don’t think so.

              I have monitored sql processes and there are rarely ever more than 4 or 5 and most I have seen is about 10 connections.

              Currently running with 4 cpu’s and 8 Gb of RAM and sitting around 70% cpu most of the time. Hanging in there but not convinced I have the setup right at this stage.