Jump to content

error: too many connections


Frank Vèssia
 Share

Recommended Posts

i got this error code in one of my pw site. This website count an average of 4k unique visitors and the home page is very simple. I maybe made something wrong?

It happends when i refresh the page, sometimes i get this error sometimes the page loads correctly.

Warning: mysqli::mysqli() [mysqli.mysqli]: (08004/1040): Too many connections in /public_html/wire/core/ProcessWire.php on line 88

Warning: mysqli::set_charset() [mysqli.set-charset]: Couldn't fetch Database in /public_html/wire/core/ProcessWire.php on line 92

Warning: mysqli::query() [mysqli.query]: Couldn't fetch Database in /public_html/wire/core/Database.php on line 57

Warning: Database::query() [database.query]: Couldn't fetch Database in /public_html/wire/core/Database.php on line 72

Fatal error: Exception: SELECT id, class, flags FROM modules ORDER BY class (in /public_html/wire/core/Database.php line 72) #0 /public_html/wire/core/Modules.php(128): Database->query('SELECT id, clas...') #1 
/public_html/wire/core/Modules.php(73): Modules->load('/home/hdps/doma...') #2 
/public_html/wire/core/ProcessWire.php(95): Modules->__construct('/home/hdps/doma...', '/home/hdps/doma...') #3 /public_html/wire/core/ProcessWire.php(45): ProcessWire->load(Object(Config)) #4 
/public_html/index.php(151): ProcessWire->__construct(Object(Config)) #5 {main} in /public_html/index.php on line 186
This error message was shown because the site is in DEBUG mode.

Link to comment
Share on other sites

I'm not sure that it matters what's on your homepage–it looks like you are running up against the allowed number of connections to your MySQL server.

You can try enabling the cache for your homepage, but that just speeds up render time, it doesn't eliminate the fact that there is going to be 1 MySQL connection per person hitting your site. And your web host doesn't allow the number of connections that your site is getting. If you are on a fairly inexpensive hosting plan, this might be a good reason to upgrade. If you are already on a high end hosting plan (or VPS) then I would ask them to increase the number of allowed connections.

Link to comment
Share on other sites

Since you are on a dedicated server, sometimes the MySQL installations are very much "default" setups and not really optimized to the server. So there may be benefit in tweaking various aspects of it. But assuming your server load and memory usage is not pushing available resources, you should be able to let MySQL use more of those resources. However, it would be good to double check the memory especially and make sure you've got enough.

You mentioned 4000 unique visitors (I'm assuming over 1 day), but how many pageviews? The pageviews are probably going to give a better indication of how much traffic the server is having to deal with, and whether they occur in spikes or are spread out evenly over the day.

I recently assisted a friend with his WordPress installation, and his daily unique visitors was similar to yours. The cheap hosting account it was on was constantly getting those MySQL errors, so we moved it to a dedicated server. Even the dedicated server could barely handle it. We ended up installing W3 Total Cache for WordPress. That particular cache can completely eliminate WordPress from handling most requests and deliver everything with static files (through some htaccess trickery). (I'm sure we'll have something similar for ProcessWire eventually.) That solved it in this case with WordPress. But I thought it was interesting to note that this traffic level appears to be at the point where an entry level dedicated server may no be enough. So even if you are on a dedicated server, it may still come down to needing more hardware resources on that actual server to handle the traffic spikes.

Link to comment
Share on other sites

If you have Dedicated or VPS also you can customize your MYSQL in server file in /etc/my.ini or my.cnf you can setup all things to work perfect server and speed it up, we have in one VPS 25k unique visitors and work perfect.

# Enable it for vast improvement and it may be all you need to tweak.
query_cache_type=1
query_cache_limit=1M
query_cache_size=32M

[mysqldump]
quick
max_allowed_packet=16M
# interactive_timeout=180
interactive_timeout=100
# max_connections=500

just try to customize it for your server performances,

Link to comment
Share on other sites

Great suggestions drilonb! If I recall, some of these MySQL settings might be different depending on what hardware resources the server has. What type of VPS you are using to handle 25k daily unique visitors? For instance, processwire.com is using an Essential VPS (lowest cost one) from here: http://www.servint.com/vps.php – Which of those packages does your VPS most closely line up with?

Thanks,

Ryan

Link to comment
Share on other sites

Yes Ryan we are using VPS in Germany because we are in Europe and we need to have fast connection in link this is My VPS performance they are Xen Processor, they have a nice prices http://alvotech.de/vserver/compare/

2048 MB RAM guaranteed

8192 MB RAM burstable

120 GB storage

2 fixed ip addresse

unmetered bandwidth***

Control Panel for automatic installations, reboot, rdns & firewall

Downtime 5 min in month lol only when i reboot dhe VPS,

This servers are self manager you need to configure it , install cPanel or Direct Admin or other WHM ,

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...