Page 1 of 2
projecteuler.net database problems
Posted: Fri Dec 28, 2007 7:25 pm
by apnt
Just as a heads up, you're maxing out your mysql database connections
Warning: mysql_connect() [function.mysql-connect]: User project_euler_2 already has more than 'max_user_connections' active connections in /mounted-storage/home15b/sub001/sc17392-BXBG/projecteuler.net/index.php on line 67
Could not connect to MySQL
This happened just a few minutes ago while accessing the problems section.
Re: projecteuler.net database problems
Posted: Fri Dec 28, 2007 10:51 pm
by stijn263
just lost a very long post due to that bug

Re: projecteuler.net database problems
Posted: Fri Dec 28, 2007 10:59 pm
by daniel.is.fischer
Commiserations. Anybody got an idea how to circumvent that in the future? We already migrated to a different SQL-server.
Re: projecteuler.net database problems
Posted: Fri Dec 28, 2007 11:12 pm
by stijn263
don't know wether a larger and faster server would solve it, but should money be the problem, i suggest placing a "Donate to Project Euler" link somewhere. i think a lot of users would love to be able give something back to PE (well, i know i would, and i hope i'm not overgeneralizing

)
until then, i'll just keep spamming you with problem suggestions

Re: projecteuler.net database problems
Posted: Fri Dec 28, 2007 11:30 pm
by daniel.is.fischer
henk263 wrote:don't know wether a larger and faster server would solve it, but should money be the problem, i suggest placing a "Donate to Project Euler" link somewhere. i think a lot of users would love to be able give something back to PE (well, i know i would, and i hope i'm not overgeneralizing

)
Cool, every other PE user giving a quid a month, we could even get paid
until then, i'll just keep spamming you with problem suggestions

By all means, do.
Re: projecteuler.net database problems
Posted: Sat Dec 29, 2007 12:07 am
by apnt
daniel.is.fischer wrote:Commiserations. Anybody got an idea how to circumvent that in the future? We already migrated to a different SQL-server.
Here's some ideas in no particular order.
1. Experiment switching between the mysql_connect and mysql_pconnect functions. Persistent connections will be better in some cases.
2. Increase the 'max_user_connections' value in your my.cnf file, if you have control over your database server.
3. Get a better-- more ram/faster processor/faster disk access database server
4. Add a database slave server or an array of database servers.
Re: projecteuler.net database problems
Posted: Tue Jan 01, 2008 11:57 pm
by Zell
I see this is still happening. Might you be using persistent connections for some of your queries? Or do you perhaps open connections to several different databases in one session? I believe that confuses PHP's connection reuse mechanism. Try examining phpinfo() -- it should show active persistent connections. Do you have any idea how many DB connections your host allows? I assume you're in a shared environment.
Re: projecteuler.net database problems
Posted: Wed Jan 02, 2008 12:41 pm
by euler
The problem with using persistent connections is that if the script fails during a transaction then that particular connection will be blocked indefinitely for other users. Cumulatively this would eventually require a server restart. However, that's all academic as the hosts have the mysql.allow_persistent flag set to off. Interestingly they have the mysql.max_links flag set to unlimited (I'm not sure if this is different to the max_user_connections flag). Also I am unaware if this has been set recently in light of my continued contact with them. Please let me know if anyone else receives a "max_user_connections" error.
Re: projecteuler.net database problems
Posted: Wed Jan 02, 2008 10:38 pm
by ed_r
Me too, roughly one minute ago:
Code: Select all
Warning: mysql_connect() [function.mysql-connect]: User project_euler_1 already has more than 'max_user_connections' active connections in /mounted-storage/home81c/sub002/sc17392-BXBG/projecteuler.net/rss_display.php on line 24
Could not connect to MySQL
Perhaps you should stop geeking around on PE and get some sleep?
(OK, I made up that last line; but the rest is verbatim from the server.)
Re: projecteuler.net database problems
Posted: Thu Jan 03, 2008 12:08 am
by elendiastarman
I've had that error a few times yesterday as well...
Re: projecteuler.net database problems
Posted: Thu Jan 03, 2008 7:22 am
by euler
I've discovered subsequently that max_user_connections is set to 20, so this would explain the problems we've been having; especially as we have been having between 50 and 100 people online during the busiest times of the day. I suspect that after the Christmas holidays the numbers will decline slightly.
Re: projecteuler.net database problems
Posted: Thu Jan 03, 2008 6:59 pm
by cfox
FWIW, I also came here looking for a paypal link, when the website problems became apparent; it sure sounds like your sysadmin could use a beer and nachos fund. I spent much of my Christmas visit to my in-law's working on problems and it kept me sane (or at least busy and happy).
It's great that you provide an RSS feed, but I'd like it even more if it provided the full text of the problem, when the problem is actually posted (rather than just a title, a few days beforehand). (This would probably neither hurt nor help the bandwidth problem.)
Re: projecteuler.net database problems
Posted: Thu Jan 03, 2008 8:55 pm
by otakucode
I would gladly donate. I get the max users error very frequently and am finding it significantly difficult to submit answers. I'll get max user errors and then once it finally gets through I'll get an error saying I attempted to submit an answer before the exclusion period was over (whatever the hell that is, I'm guessing its a measure to stop people from trying to spam the server, but it is misfiring in my case) and it'll say that the exclusion period has then been extended to 30 minutes.
As for suggestions... how about swapping the servers running the forums and the ones running the problems and providing links from the problems to threads on these forums rather than having the comments be part of the problem/answer server. I'm guessing that the comments have to be 99.999% of the load on that server.
Re: projecteuler.net database problems
Posted: Thu Jan 03, 2008 9:04 pm
by daniel.is.fischer
Less. The threads will create a lot of traffic, but currently over 2000 correct answers are submitted every day, no idea how many wrong ones, that's quite some traffic, too.
Correct, the exclusion period is a measure against spamming, anybody trying to submit more than three answers within one minute is then barred for 10 minutes, any attempt during these 10 minutes to submit an answer extends the exclusion period by another ten minutes. We are aware that it is most inconvenient for those who solve a bunch of problems offline and then want to submit the whole lot, but it probably is the lesser evil.
Re: projecteuler.net database problems
Posted: Thu Jan 03, 2008 10:22 pm
by euler
otakucode wrote:As for suggestions... how about swapping the servers running the forums and the ones running the problems and providing links from the problems to threads on these forums rather than having the comments be part of the problem/answer server. I'm guessing that the comments have to be 99.999% of the load on that server.
I've already done that. I did this between Christmas and New Year to help reduce server load! At the same time I temporarily removed the Forum page, showing the threads, number of posts, and "last post by", restricting access to the thread by clicking the green tick on the Problems page table or the link at the end of each problem description - assuming you've solved it. To help I think I'll revert back to this extreme measure to see if it helps in any way at all...
Re: projecteuler.net database problems
Posted: Fri Jan 04, 2008 10:53 pm
by stijn263
i'm unable to login at the moment
Login was unsuccessful. Please check your details carefully.
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /mounted-storage/home81c/sub002/sc17392-BXBG/projecteuler.net/index.php on line 74
Warning: Cannot modify header information - headers already sent by (output started at /mounted-storage/home81c/sub002/sc17392-BXBG/projecteuler.net/index.php:74) in /mounted-storage/home81c/sub002/sc17392-BXBG/projecteuler.net/index.php on line 161
Warning: Cannot modify header information - headers already sent by (output started at /mounted-storage/home81c/sub002/sc17392-BXBG/projecteuler.net/index.php:74) in /mounted-storage/home81c/sub002/sc17392-BXBG/projecteuler.net/index.php on line 162
Warning: Cannot modify header information - headers already sent by (output started at /mounted-storage/home81c/sub002/sc17392-BXBG/projecteuler.net/index.php:74) in /mounted-storage/home81c/sub002/sc17392-BXBG/projecteuler.net/index.php on line 163
Re: projecteuler.net database problems
Posted: Fri Jan 04, 2008 11:01 pm
by elendiastarman
same here
also, accessing the problems page simply shows even more errors and no problems
*checks to copy & paste*
wow, that was fast
Re: projecteuler.net database problems
Posted: Fri Jan 04, 2008 11:49 pm
by BjornEdstrom
For web apps, I'm a huge fan of the hybrid approach of using both static files and databases at the same time. The idea is to use the database as a backend and re-generate static pages from the data in the database when the database is updated. For example, instead of users accessing
http://projecteuler.net/index.php?secti ... ems&id=176
To view the latest problem, the system will generate a static html file at publication, say
http://projecteuler.net/problems/176.html
Whenever a user submits a correct solution, the system will re-generate the ranking list. And when a user posts something in the forum, the static thread html will be regenerated.
The database only needs to be accessed when the users submits something. Using this "hybrid" approach, it is usually possible, without too many modifications to the code, to reduce the database access to zero for browsing, and only tax the database when something "active" is happening.
In either case, I hope this works out. Anything I can do to help?
Re: projecteuler.net database problems
Posted: Sat Jan 05, 2008 1:11 am
by euler
Thanks!
Actually I am working away feverishly at the moment to do something like that on my local machine. I've managed to modify the scripts to handle semi-static versions of the Problems pages, but due to the highly dynamic nature of Project Euler I've had to make serious changes elsewhere. For example, the Scores page has been changed to a Top 100 table; previously it was necessary to identify the current user's position out of the number of active users and highlight their position in the table: not possible with a static page. As you suggested I've made the problem details into static html pages.
My current plan is to update the pages every hour via cronjobs.
The forum is going to require much more thought on the best way to handle and has been the main culprit in hogging server bandwidth.
I've been working on this for the past six hours and I am in serious need of bed...

Re: projecteuler.net database problems
Posted: Sun Jan 06, 2008 2:05 am
by kotulek
I'm happy to see that PE is back again. Thank you very much euler for your hard work
