Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,604 members, 7,809,211 topics. Date: Friday, 26 April 2024 at 05:26 AM

Mysql Error :: Too Many Connections - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Mysql Error :: Too Many Connections (2060 Views)

Help On Granting A Mysql Database Access Through Remote Connections / The Fastest Web-browser For Slow Internet Connections / Opening Cpanel With Mtn/glo Connections (2) (3) (4)

(1) (Reply) (Go Down)

Mysql Error :: Too Many Connections by dhtml1(m): 6:17am On Oct 20, 2011
There was a web-portal i made for a developer and the page-view is really high, and it is showing the error- resolved now sha.

So webhosting guys :: What is the way forward? Upgrading the server?
Re: Mysql Error :: Too Many Connections by dhtml1(m): 6:17am On Oct 20, 2011
Server log:
[14-Oct-2011 12:41:50] PHP Warning:  mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections in /home/xoxo/public_html/dbase/mysql.php on line 4
Re: Mysql Error :: Too Many Connections by dhtml1(m): 7:32am On Oct 20, 2011
Re: Mysql Error :: Too Many Connections by binkabir(m): 8:08am On Oct 20, 2011
dhtml .:

Lest i forget, another relevant thread is http://dev.mysql.com/doc/refman/5.5/en/too-many-connections.html

this is good. but i will also recommend using APC extension http://php.net/manual/en/book.apc.php
its a great means to avoid some much connections to your DB.
u can test it on your local server with ZWAMP. it's cool http://zwamp.sourceforge.net/
Re: Mysql Error :: Too Many Connections by DualCore1: 8:21am On Oct 20, 2011
APC doesn't come bundled with PHP so this may not work well for dudes on shared hosting if their hosts don't already have this installed or r not willing to have it installed.

You don't need a server upgrade. If you have root access to the server you can either follow the APC suggestion above or increase the max_connection.

I have a question though. The default value is 150 (+1 for super users). So in a scenario where 300 people visit my web application all within the same period of time and are making extensive use of it. . . I will get this error at some point where all the 150 connections are in use? #stupidQuestion
Re: Mysql Error :: Too Many Connections by binkabir(m): 8:37am On Oct 20, 2011
Dual Core:

APC doesn't come bundled with PHP so this may not work well for dudes on shared hosting if their hosts don't already have this installed or r not willing to have it installed.

You don't need a server upgrade. If you have root access to the server you can either follow the APC suggestion above or increase the max_connection.

I have a question though. The default value is 150 (+1 for super users). So in a scenario where 300 people visit my web application all within the same period of time and are making extensive use of it. . . I will get this error at some point where all the 150 connections are in use? #stupidQuestion
the funny ans is "YES" but on one condition (if all they users are querying the db at the same time. look a the db connection as a meal ticket that your issue to hungry client kiss if the meal tickets are all issued out, the rest client will have to wait for some tickets to be return . at that time you tell the people on the queue that mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>" and mind you is a warning not error).

i know that APC is not part of the core PHP package and that is why i referred to the zwamp server(for testing purpose).
the solutions is for VPS.
if in any situation you have a critical application then shared hosting is not a good option to you.
a quick solution is to use php sessions too.
Re: Mysql Error :: Too Many Connections by DualCore1: 8:42am On Oct 20, 2011
Yea if they querying at the same millisecond (depending on the length of the query), right? grin
That's a relief.


BTW, I get clients asking for SSL or dedicated IP allocation for their shared hosting account and in my head I just wonder. I still have to politely tell them how its not logical to have SSL (which requires a dedi IP) on a shared server and how it doesnt make much sense to put anything that secured on a shared account. . . VPSes are the way forward for those.
Re: Mysql Error :: Too Many Connections by binkabir(m): 8:49am On Oct 20, 2011
Dual Core:

Yea if they querying at the same millisecond (depending on the length of the query), right?  grin
That's a relief.


BTW, I get clients asking for SSL or dedicated IP allocation for their shared hosting account and in my head I just wonder. I still have to politely tell them how its not logical to have SSL (which requires a dedi IP) on a shared server and how it doesnt make much sense to put anything that secured on a shared account. . . VPSes are the way forward for those.

i recently found out that is cheater to have your own vps than putting different apps on little shared hosting packages.
one of the benefit is centralization of all clients apps another is that when u install extensions that optimize application and user bandwidth your small client can have the bonus and we promote your company consciously or sub-consciously
kiss
Re: Mysql Error :: Too Many Connections by gorimapa1(m): 4:03pm On Oct 20, 2011
Thanks guys for your contributions.
Re: Mysql Error :: Too Many Connections by Nobody: 4:51pm On Oct 20, 2011
Re: Mysql Error :: Too Many Connections by gorimapa1(m): 9:09pm On Oct 20, 2011
This is the handi-work of the spam bot again. . .
Re: Mysql Error :: Too Many Connections by Nobody: 9:19pm On Oct 20, 2011
Hmmmm am guessing, if the information is common to all users then the information can be cached, but if its specific to each user, then a sort of dynamic caching using session that way second hit reads from File,
Re: Mysql Error :: Too Many Connections by gorimapa1(m): 9:47pm On Oct 20, 2011
I dont quite understand what you are trying to say (scratching my head) - which information are you talking about here?
Re: Mysql Error :: Too Many Connections by Nobody: 9:50pm On Oct 20, 2011
i made a wrong assumption.
Re: Mysql Error :: Too Many Connections by gorimapa1(m): 10:07pm On Oct 20, 2011
I presumed so, because that your post does not seem to match this thread at all
Re: Mysql Error :: Too Many Connections by Nobody: 10:09pm On Oct 20, 2011
dhtml or gori-mapa ? isnt that ur signature. nairaland bot again. grin
Re: Mysql Error :: Too Many Connections by lojik(m): 10:40pm On Oct 20, 2011
I used to face this problem when i was developing my db wrapper class. What i did was to optimize my codes so that only one connection is open per page load no matter how many files were included. I kept the first connection alive and made sure i did not reconnect to mysql throughout a page.

It worked for me because there were too many connection calls while processing a page. This error was in my class though, not that 150 people were visiting my page simultaneously.

If you are using a framework and including so many files to generate a page, make sure you are not starting a new connection on every included file.
Re: Mysql Error :: Too Many Connections by dhtmli(m): 11:22pm On Oct 20, 2011
This is exactly how i work - but the site is a high-traffick site - because a lot of money transaction goes on simultaneously.

(1) (Reply)

Javascript Help! / 5 Million Gmail Usernames And Passwords Leaked Online, Check Yours Now / Futo Merit List Is Out For 2017/2018

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 24
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.