PhotoPost Community

PhotoPost Community (http://www.photopost.com/forum/)
-   General Discussion (http://www.photopost.com/forum/general-discussion/)
-   -   Randomize Database User Connections (http://www.photopost.com/forum/general-discussion/140847-randomize-database-user-connections.html)

skidpics September 25th, 2009 11:58 AM

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?

Chuck S September 25th, 2009 07:28 PM

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.

skidpics September 26th, 2009 12:27 AM

Not for VB - just basic PP Pro

Chuck S September 26th, 2009 06:38 AM

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.

skidpics September 27th, 2009 12:12 AM

Quote:

Originally Posted by Chuck S (Post 1252997)
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.

I basically need something like this:

$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

skidpics September 27th, 2009 12:26 AM

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.

Chuck S September 27th, 2009 06:32 AM

yeah thats probally a very basic way to do it for your situation if your mysql password is the same for all users sure.

skidpics September 27th, 2009 08:57 AM

Quote:

Originally Posted by Chuck S (Post 1253047)
yeah thats probally a very basic way to do it for your situation if your mysql password is the same for all users sure.

True.

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..

Chuck S September 27th, 2009 12:34 PM

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.

skidpics September 27th, 2009 05:21 PM

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.

Chuck S September 27th, 2009 05:28 PM

No you dont want powweb.

Check out my host westhost.com

skidpics September 27th, 2009 05:41 PM

What's wrong with PowWeb?

Unlimited Space/ Unlimited data

skidpics September 27th, 2009 05:47 PM

well, Bluehost is out - 60 only and only shared hosting.

skidpics September 27th, 2009 05:50 PM

well, the randomizing of users for the DB seemed to solve my problem 4 now...

Chuck S September 27th, 2009 06:20 PM

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


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97