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 комментариев

avatar
Я думаю у твоего хостера слишком жесткое ограничение на количество одновременных коннекшенов к mysql. Можно сменить хостера :)
avatar
скорее, нужно сменить хостера, если он не увеличит лимит
avatar
а как посмотреть какой лимит у меня сейчас?
avatar
Никак нельзя. Посмотреть может только администратор.
avatar
Так я и есть администратор своего хостинга!
Вот, что суппорт ответил:

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.
avatar
Эта квота прописана в конфигах СУБД, пользователи хостинга не имеют к ней доступа даже на чтение. Я подозреваю, что ты всё-таки пользователь, а не администратор.
avatar
До меня только дошло что ты считаешь хостингом свой шаред аккаунт и виртуальный сервер, на котором пашет твой сайта. Под хостингом понимают услугу либо технологическую площадку, но никак не пользовательский аккаунт.
avatar
Как быть то? :(
Неужели там при 10 юзерах на сайте — будет вырубать базу? Да такого быть не может,
тж какая то детская база, у мпня там всего 5 записей, а он уже загинается, ну парадокс же!
avatar
Саппорт тебе написал, что квота устанавливается на группу и кто-то из твоих соседей по группе выбирает её всю, не оставляя тебе коннектов. Вот он, козлиный оскал оверселлинга! Меняй хостера не раздумывая.
avatar
А вот смотрите смотрите
mediatemple.net/webhosting/gs/features/containers.php#mysql
мой хостинг предлагает отдельные MySQL сервера, которые работают отдельно, как отдельный сервак!
Как вы думаете? Может хостинг оставить у себя простой — а поставить mySQL сервер отдельынй!
Кстати 128 мегабайт (тариф ЛАЙТ) он подойдет для ЛС? Просто я никак понять не могу, какой у меня на хостинге MySQL стоит, чтобы сравнить!
avatar
Выделенный сервер для базы — обычная практика для более-менее крупных хостеров. Ей присущи свои минусы и плюсы, но в отношении Mediatemple не хотелось бы ничего комментировать.

У меня с ними был весьма неприятный опыт, потому оставлю при себе своё мнение об этой конторе. Возможно, с тех пор они изменились в лучшую сторону, а я об этом не знаю.
avatar
Okay, please, take a step back, and calm down. We are not restricting your use of MySQL in a way that will cripple the functionality of your site. Please allow me to explain.

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.

blog.mediatemple.net/weblog/2007/01/19/anatomy-of-mysql-on-the-grid/

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.
avatar
$20/month за MySQL?!!! Меняйте хостера!
Я за VPS 256RAM/300Mhz/20HDD в довольно неплохой компании плачу $15.
avatar
Вы что смеётесь? У меня 1GB RAM, 1000GPU, 100GB — за 20 доларов!
Правда как выяснилось база общая на всех!
Кароче как в общаге, много людей пришло в разные комнаты, лимит исчерпан, а мои гости ко мне не попали! Типа максимум 20 человек в комнате может быть, ко всем пришло 18, а ко мне хотели попасть 4 = тогда передоз, типа вроде ВСЕ УХОДИТЕ (too many connections).

Думаю все таки отдельынй mySQL нужен, он никогда не упадет и достаточно мощный, я думаю что вполне возможно его взять, тогда получается 20$(hosting)+20$(mySQL lite) тогда, я как бы живу в своей комнате, она по прежнему общая, но у меня будет своя собственная дверь во двор! Могу приглашать сколько захочу!
avatar
Это очень дорогая контора и далеко не лучшая по качеству. Подумайте над переездом, а упасть может что угодно. Уверенным можно быть только на дедике.
avatar
Я просто привык к ней, а ради экономии 5 долларов в месяц, ну как то ломает меня. К тому же я не могу пользоваться русскими провайдерами. Там же паспорт требуют и вообще я за океаном )
avatar
тоже самое с моим сайтом

SQL Error: Too many connections at /home/l/lostcatsru/catfotocom/public_html/engine/modules/database/Database.class.php line 66
Array ( [code] => 1040 [message] => Too many connections [query] => mysql_connect() [context] => /home/l/lostcatsru/catfotocom/public_html/engine/modules/database/Database.class.php line 66 ) 


хостинг SpaceWeb

впервые за несколько месяцев
avatar
база не выдерживает. слишком много запросов
avatar
та же проблема, хостинг majordomo
LS такой требовательный что ему нужен только свой сервак?
Посещаемость почти нулевая, ну чел 20 в день, как быть?
avatar
будет ответ? поиском искал, ничего не нашел
Только зарегистрированные и авторизованные пользователи могут оставлять комментарии.