![]() |
Randomize Database User Connections Until I get a dedicated server, I am only allowed 50 MySQL connections - per database users. I can get around that, as suggested my my hosting support, to add more database users, and randomly connect to the DB with those different users. Would anyone know how to randomize the connection process, for more users? |
That would definately take a good deal of rewriting of the entire $link section here. As to what would need to be changed I have never personally looked at it. Code: Content visible to verified customers only. |
Not for VB - just basic PP Pro |
Right I am merely stating anything you do or code up would probally be centered around there as thats where we define the $link and $db_link lines. |
Quote:
$mysql_user1="vande11_user1"; $mysql_user2="vande11_user2"; $mysql_user3="vande11_user3; $random_user = $mysql_user1, $mysql_user1, $mysql_user1 $mysql_user= $random_user I am guessing this should work for each login.. as it will randomly select a differnet users based on the $random_user |
I this should work.. $the_dbarray = array( "user1", "user2", "user3", "user3" ); //<--Note the extra "item3" shuffle($the_dbarray); $mysql_user = $the_dbarray This should select 1 of the users# for a database connection, then pass the results to $mysql_user. Testing it, it is working. I would figure if there was an error, I would not be able to login ;-) If only now I can base the random of Max_Sql connections, then it would work perfect.. for shared hosting, at this point in time. |
yeah thats probally a very basic way to do it for your situation if your mysql password is the same for all users sure. |
Quote:
It would be nice the make it more of an if .. else kinda thing, where it checks connections maxed out or not. I will keep looking for code snippets that will help me until such time as I move to a dedicated server. thanks.. |
yeah well if your host limits mysql connections to 50 per user sounds to me like you need a better host as thats even way more restrictive than powweb which I think is like 50000. |
You are right. I am on shared housting though - for now.. Bluehost has some good options, so I am in touch with them.. Powweb I haven't checked out yet - but will look into it. |
No you dont want powweb. Check out my host westhost.com |
What's wrong with PowWeb? Unlimited Space/ Unlimited data |
well, Bluehost is out - 60 only and only shared hosting. |
well, the randomizing of users for the DB seemed to solve my problem 4 now... |
Thats a good thing. |
| All times are GMT -5. The time now is 04:19 AM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0