mySQL - too many connections!
SQL Error: Too many connections at /nfs/c03/h03/mnt/55936/domains/stavka.ru/html/classes/modules/sys_database/Database.class.php line 66
Array ( [code] => 1040 [message] => Too many connections [query] => mysql_connect() [context] => /nfs/c03/h03/mnt/55936/domains/stavka.ru/html/classes/modules/sys_database/Database.class.php line 66 )
Вот, что в 66 строчке
$oDbSimple=DbSimple_Generic::connect($sDSN);
Сайт работал, в день 10 посетителей, я спокойно на нем серфил и он взял и просто перестал отвечать!
Я полез в админску панель ч phpADMIN и не смог войти, там тоже too many connections!
Пришел к выводу, что меня кто-то ДДОСИЛ! Но трафика не набежало, как быть? Объясните пожалуйста что это было и как этого избежать? Как выявить, что сайт ДДОСят?
20 комментариев
Вот, что суппорт ответил:
Another user was causing a very high load on your MySQL container, I just checked the container graphs for the past hour. That user has since been removed and put into his own container. Now the database server you are on is back to its normal levels and you should not be receiving the message anymore. On the MySQL smartpool for the Grid you are allowed 30 active Connections to the database. More than 10 users should be fine, for this case it was just another client using the database that was causing the problems. Please update this ticket if you have anymore problems or inquires.
Неужели там при 10 юзерах на сайте — будет вырубать базу? Да такого быть не может,
тж какая то детская база, у мпня там всего 5 записей, а он уже загинается, ну парадокс же!
мой хостинг предлагает отдельные MySQL сервера, которые работают отдельно, как отдельный сервак!
Как вы думаете? Может хостинг оставить у себя простой — а поставить mySQL сервер отдельынй!
Кстати 128 мегабайт (тариф ЛАЙТ) он подойдет для ЛС? Просто я никак понять не могу, какой у меня на хостинге MySQL стоит, чтобы сравнить!
У меня с ними был весьма неприятный опыт, потому оставлю при себе своё мнение об этой конторе. Возможно, с тех пор они изменились в лучшую сторону, а я об этом не знаю.
In regards to the limit on the number of simultaneous connections that your user can maintain to the database server, there are two important things that I believe you may be overlooking.
Firstly, the limit of connections to the database server is effectively a per-node limit, due to the way MySQL identifies users, and so your site can actually have many more connections open at any given time than this limit would normally imply if you were hosted on a single server.
Secondly, when a user is viewing your site, they will not maintain a MySQL connection the entire time. Your scripts will open a connection only for as long as is necessary to retrieve the data required to display your pages. This means that, given a limit of 10 connections, you could probably have hundreds of people reading your page at the same time. You do not need to make any changes to your site, and you do not need to worry about your site crashing due to excessive traffic.
Given these two points, you may be slightly confused as to how you encountered a warning regarding Too Many Connections. The reason is that this warning did not apply to the limit for your user's connections; it applied to the limit of connections to the server as a whole for all users that have access to it. The MySQL server that your databases are hosted on currently is a shared MySQL server accessed by many other users, because you are using our SmartPool v.2. This means that the activity of other sites on the (gs)Grid-Service can affect the performance and/or availability of your MySQL server if the wrong kind of activity is generated by those other sites. When you encountered your issue previously, this is exactly what occurred.
The MySQL server was locked up and had taken too many connections from all the users on the server combined, and so it could not handle a new connection from any user that would normally be able to. We have automated and live monitoring of shared MySQL servers on the (gs)Grid-Service to ensure that such issues are dealt with swiftly, and we apologize for the inconvenience they cause, but we will not be able to completely prevent them. Please see the article below for more detail regarding the architecture of our database systems on the (gs)Grid-Service.
If you would like to isolate yourself from the activity of other users you can purchase a dedicated MySQL Container for your databases, but if you have only a few users on your site the majority of the time this may not be necessary unless it is absolutely essential that there be no interruption to your services for those users.
Я за VPS 256RAM/300Mhz/20HDD в довольно неплохой компании плачу $15.
Правда как выяснилось база общая на всех!
Кароче как в общаге, много людей пришло в разные комнаты, лимит исчерпан, а мои гости ко мне не попали! Типа максимум 20 человек в комнате может быть, ко всем пришло 18, а ко мне хотели попасть 4 = тогда передоз, типа вроде ВСЕ УХОДИТЕ (too many connections).
Думаю все таки отдельынй mySQL нужен, он никогда не упадет и достаточно мощный, я думаю что вполне возможно его взять, тогда получается 20$(hosting)+20$(mySQL lite) тогда, я как бы живу в своей комнате, она по прежнему общая, но у меня будет своя собственная дверь во двор! Могу приглашать сколько захочу!
хостинг SpaceWeb
впервые за несколько месяцев
LS такой требовательный что ему нужен только свой сервак?
Посещаемость почти нулевая, ну чел 20 в день, как быть?