1
toddherrold
potential max_questions resource solution

I posted this on large thread for max_questions, but thought I would raise it up to a new thread, given my sense that this is the solution that many of us are looking for.

What is needed is this tailored to XOOPS by someone who knows the code better than I do. Can someone look at this and determine how to implement a similar solution for XOOPS. (I tried to delete my other post, but don't have the priviledge, so apologies for duplication. I felt this is a serious issue for many of us and wanted to make sure it got noticed).

Thanks!

Quote:
(host) currently limits users to 72,000 SELECT queries, per hour, per user. Once you have used up your quota, you will begin to receive "max_questions" errors until the end of the hour, and your quota is reset. Please note, this limit only applies to SELECT queries, and not INSERT queries. There has been no official word on whether UPDATE queries are affected.

Most users will never notice this limitation, however there are some programs out there that are very unconservative with their queries. Forums (AKA: bulletin boards, message boards) such as phpbb and CMS's (Content Management Systems) such as phpnuke are typically the greatest offenders due the large number of queries and the rapid click through rate.

To compensate for this limitation, you can set up 2 additional users (for a total of 3 users), and spread out your queries among them. This will give you a total of 216K SELECT queries. To set this up, you must complete 5 steps.

1) Log in to ops and go to packages > MySQL. Add users until you have 3, making sure that each user has the exact same password.

2) Locate where the database information is stored. Often it will be in a file called config.php, base.php, include.php or common.php. You should find the name, the user name, password, and server for your database.

3) Once you have found the file, you will see the variables defined in one of two fashions.
A regular variable will look like this: $db_user = "user_name";
Defined variables will look like this: define("db_user", "user_name");

4) Add the following lines of code immediately after the line you commented out.

$db_user_array[] = ""; //enter 1st user name
$db_user_array[] = ""; //enter 2nd user name
$db_user_array[] = ""; //enter 3rd user name

5) Depending on whether your script uses regular variables, or defined variables, enter one of the following lines after everything else we just added. Make sure you change "db_user" into whatever the correct name should be (see the line that you commented out).

//regular variable
$db_user = $db_user_array[ rand( 0, ( sizeof($db_user_array) -1 ) ) ];

//defined variable
define( "db_user", $db_user_array[ rand( 0, ( sizeof($db_user_array) -1 ) ) ] );

If you end up needing to remove one of your database user names in order to allow someone else to use your database, or if Powweb changes their number of users, updating the rotation script is as simple as adding or removing users from the list (eg: $db_user_array[] = ""

Login

Who's Online

284 user(s) are online (236 user(s) are browsing Support Forums)


Members: 0


Guests: 284


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits