vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   50,000 Questions workaround project (https://vborg.vbsupport.ru/showthread.php?t=109208)

Zachariah 03-01-2006 01:21 PM

50,000 Questions workaround project
 
If you have a shared host for your website you may know what I mean. MySQL users get 50,000 Questions per hour. The account is banned then after the hour you get access again.

The hosts will allow you to create unlimited users per DB.

If I reindex the search index of my forums.
"" "" any part of my site that has a lot of data.

- 50,000 limit smashed and no access / DB errors


PLAN: "mySQL user load balance"
- This works for the most part untill error ER_USER_LIMIT_REACHED then the script failes to work.

I think this could use some sort of:
- counter in session memory per user and stop using account when close to 50k.
- IF mysql connect gives error ER_USER_LIMIT_REACHED (Error Number : 1226) THEN skip that user and use the next one.

includes/config.php


Quote:

// ****** DATABASE NAME ******
// This is the name of the database where your vBulletin will be located.
// This must be created by your webhost.
$config['Database']['dbname'] = 'forum';

// ****** TABLE PREFIX ******
// Prefix that your vBulletin tables have in the database.
$config['Database']['tableprefix'] = '';

// ****** TECHNICAL EMAIL ADDRESS ******
// If any database errors occur, they will be emailed to the address specified here.
// Leave this blank to not send any emails when there is a database error.
$config['Database']['technicalemail'] = 'dbmaster@example.com';


// ****** MASTER DATABASE SERVER NAME AND PORT ******
// This is the hostname or IP address and port of the database server.
// If you are unsure of what to put here, leave the default values.
$config['MasterServer']['servername'] = 'localhost';
$config['MasterServer']['port'] = 3306;

// User array.
// ################################################

$dblogins = array();
// ****** MASTER DATABASE USERNAME & PASSWORD ******
// This is the username and password you use to access MySQL.
// These must be obtained through your webhost.
$dblogins['1']['user'] = 'root';
$dblogins['1']['pass'] = '';

// ****** MASTER DATABASE USERNAME & PASSWORD ******
// This is the username and password you use to access MySQL.
// These must be obtained through your webhost.
$dblogins['2']['user'] = '';
$dblogins['2']['pass'] = '';

// ****** MASTER DATABASE USERNAME & PASSWORD ******
// This is the username and password you use to access MySQL.
// These must be obtained through your webhost.
$dblogins['3']['user'] = '';
$dblogins['3']['pass'] = '';


// ****** MASTER DATABASE PERSISTENT CONNECTIONS ******
// This option allows you to turn persistent connections to MySQL on or off.
// The difference in performance is negligible for all but the largest boards.
// If you are unsure what this should be, leave it off. (0 = off; 1 = on)
$config['MasterServer']['usepconnect'] = 0;


// ********* place @ bottem of Config.php file before ?>
// ##########################################
srand((float) microtime() * 10000000);
$dbloginid = array_rand($dblogins);
while ($dblogins[$dbloginid]['user'] == '')
{
$dbloginid = array_rand($dblogins);
}
$config['MasterServer']['username'] = $dblogins[$dbloginid]['user'];
$config['MasterServer']['password'] = $dblogins[$dbloginid]['pass'];

unset($dblogins, $dbloginid);
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Data used and results:

$dblogins['1']['user'] = 'root2';
$dblogins['2']['user'] = 'root3';
$dblogins['3']['user'] = 'root4';

I have tested Code posted.
Reindex of forums search.

Quote:

Processing: 102279 ... Done
Processing: 102281 ... Querying first post of thread... Done
Processing: 102282 ... Done
Processing: 102283 ...

Invalid SQL:
INSERT IGNORE INTO word (title) VALUES ('annnnnnything');

MySQL Error : User 'root4' has exceeded the 'max_questions' resource (current value: 50000)
Error Number : 1226

Marco van Herwaarden 03-01-2006 01:28 PM

This is an old solution. You will find similar posted at vb.com.

Zachariah 03-01-2006 01:31 PM

Yep, reason I am here.
REFF - http://www.vbulletin.com/forum/showthread.php?t=160852

Zachery 03-01-2006 01:32 PM

Quote:

Originally Posted by Zachariah

Or magicly you could find a not crappy host :)

Zachariah 03-01-2006 01:34 PM

Quote:

Originally Posted by Zachery
Or magicly you could find a not crappy host :)

- True the easy way out is to give up, but I am stubborn as a mule.

Marco van Herwaarden 03-01-2006 01:35 PM

You could use a seperate user for long running queries, based on the value of THIS_SCRIPT.

If 1 single transaction uses more then the maximum, then there is not much you can do (you can't make things switch half way in teh execution of a single statement).


All times are GMT. The time now is 03:07 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01003 seconds
  • Memory Usage 1,730KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete