0

I am on shared server and I have some limitations at "simultaneous processes". I have two websites: one which uses database and other without database (it's only HTML). Both are hosted on the same shared. When I reach the "simultaneous processes" the website which uses database shows "Server message: too many connections" and the second website works well and loads fast. What is the difference between sites? Both sites has ~ the same number of visitors. This happens because of database? So it's recommended to not use a database?

If I'm not on the right place, or there is a problem with my question, please tell me, I can delete it.

EDIT

Both websites has ~ 100.000 hits/day

It's a html page more faster than a dynamic page with MySQL connection? If I am using only HTML page do you think I won't have problems with simultaneous connections?

Thanks a lot!!!

closed as too broad by John Conde Jun 17 '14 at 15:18

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • You really just need a better webhost and/or write better code. You should never be seeing that error message on a decent host with decent code. – John Conde Jun 17 '14 at 15:19
1

I'm guessing your database has too many connections. Do you use p_connect (persistant connections)? If so, stop doing that.

Other than that, there is a setting which allows the maximum amount of connections (which you've crossed). Either optimise your queries so you have less and faster queries (so 1 connection exists for a shorter amount of time) or find a way to change the setting.

The latter might prove difficult, your hoster might pipe this down, normal settings in normal websites should not trigger this error.


You can check the current max-connections value with this query:

show variables like "max_connections";

This page shows you how to change the values, but it's very likely your hoster controls this and will not change this for you.


Unless you have a site with a few hundred hits per day (if the setting is one hundred), you should not get this message. Set indexes in your table, switch to INNOdb where you need row-locking instead of table-locking, search on integer instead of strings, use LIMIT, etc.

Another method, a bit more work, is creating cached results. If you have a menu, does your menu differ a lot, or is it sufficient to build the menu in a htmlfile and update that once per hour/day/week? Are there other pages/sections you can prebuild so the next visit doesnt need a databasehit?

  • I have over 100.000 hits per day on both websites. – MM PP Jun 17 '14 at 15:23
  • 1
    And you don't know about stuff like this? Hm. Well anyway, it's an database problem. Time to tweak your database, possibly by someone with advanced knowledge about the matter. You can do some research about the matter now, how de decrease this, I've listed a view tips in my answer. I've added a part about caching results – Martijn Jun 17 '14 at 21:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.