We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9207 ☆ A M B ☆
    • 2,475 Posts
    One of my high traffic sites is on a dedicated server, and that server is getting a lot of traffic... so much that it’s starting to experience brown-outs. I’m seeing a lot of Parser errors in Reports-->System Events:

     Error:	mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'sending authentication information', system error: 32	 
      Error type/ Nr.:	Warning - 2	 
      File:	/var/www/zamm/html/manager/includes/extenders/dbapi.mysql.class.inc.php	 
      Line:	89	 
      Line 89 source:	 if (!$this->conn = ($persist ? mysql_pconnect($host, $uid, $pwd) : mysql_connect($host, $uid, $pwd, true))) {	


    And also some of these:
    PHP error debug
      Error:	Invalid argument supplied for foreach()	 
      Error type/ Nr.:	Warning - 2	 
      File:	/var/www/zamm/html/manager/includes/document.parser.class.inc.php(769) : eval()'d code	 
      Line:	243


    Are we seriously in trouble? I mean... I know our server is probably in over its head, but what bothers me is that when this error fires, it broadcasts to the world more information than I’d care to share... I’d much prefer a way to fail silently.

    And relatedly... anyone got hot tips on tweaking a linux server for better performance?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I think you can configure MySQL to open more "listeners" (at least that’s what they’re called in Oracle), but I don’t know how that would impact other server resources.
        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
        • 9207 ☆ A M B ☆
        • 2,475 Posts
        Which configuration file is that? My.cnf? Or is there something in apache? I.e. in http.confd ?
          • 22303 MODX Staff
          • 10,725 Posts
          Unfortunately with the current releases of MODx (0.9.6.x), in order to prevent the display of FATAL errors like this, you would need to customize the messageQuit() function in manager/includes/document.parser.class.inc.php.

          Ideas to improve performance and avoid the errors:
          [*] Make sure everything that can be cached is (e.g. Ditto and Wayfinder calls, or other snippets that could be updated only when editors clear cache).
          [*] Install and configure eAccelerator or an equivalent op-code cache which can save a lot of CPU and response time.
          [*] Tune mysql to handle more connections. This might solve part of the problem, though this can be a difficult task to get right.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
              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
              • 9207 ☆ A M B ☆
              • 2,475 Posts
              What’s really funny is that IE Windows chokes earlier under traffic load than all the other browsers... we tried to replicate the problems (mostly that a flash player on the page wouldn’t load when the page was getting hit hard), but IE Windows was the only browser where that would manifest.

              Thanks for the suggestions... I’ll work to implement them... *crosses fingers*
                • 9207 ☆ A M B ☆
                • 2,475 Posts
                I cached all my major Snippet calls, and I also tweaked my /etc/my.cnf file based on the outputs from the handy MySQLTuner program.

                Specifically, I’ve modified my MySQL configuration to match our server better (/etc/my.cnf):
                [mysqld]
                # [...]
                skip-bdb
                # * Fine Tuning
                query_cache_limit = 2M
                query_cache_size = 16M
                tmp_table_size = 32M
                max_heap_table_size = 16M
                key_buffer = 8M
                max_allowed_packet = 8M
                thread_stack = 128K
                thread_cache_size = 8
                max_connections = 200
                table_cache = 64


                I realize that this is highly dependent on hardware... but I was guided by multiple checks using the mysqltune.pl program I mentioned above.

                I’m gonna try the php caching next... still crossing my fingers as our traffic increases for today’s onslaught...
                  • 10449
                  • 956 Posts
                  Define "a lot of traffic". Do you have some ballpark numbers?

                  Are these numbers accurate? http://www.quantcast.com/zamm.com#traffic
                  That would be approx. 65k visitors per month... A dedicated server should handle that fine, imho.

                  I’d analyze the site with adding php/mysql/rendering stats in the html-code. If you see unusually high mysql request numbers, try to find bottlenecks in your site (e.g. reduce the number of Ditto-calls per page etc.)
                    • 9207 ☆ A M B ☆
                    • 2,475 Posts
                    Those numbers are low... we’re looking to push 200k visitors this month. I still think we should be getting a lot more milage out of our server.

                    What rendering stats do you typically look at?
                      • 9207 ☆ A M B ☆
                      • 2,475 Posts
                      How does Zend’s Performance Suite compare to eAccelerator? The eAccelerator code hasn’t been updated in a while, so I’d tend to lean towards Zen.

                      Also, how do I know whether php is running in cgi mode or in fast-cgi mode?