Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 03-01-2006, 01:21 PM
Zachariah's Avatar
Zachariah Zachariah is offline
 
Join Date: Feb 2002
Location: Canoga Park, CA
Posts: 2,125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 03-01-2006, 01:28 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is an old solution. You will find similar posted at vb.com.
Reply With Quote
  #3  
Old 03-01-2006, 01:31 PM
Zachariah's Avatar
Zachariah Zachariah is offline
 
Join Date: Feb 2002
Location: Canoga Park, CA
Posts: 2,125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yep, reason I am here.
REFF - http://www.vbulletin.com/forum/showthread.php?t=160852
Reply With Quote
  #4  
Old 03-01-2006, 01:32 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachariah
Or magicly you could find a not crappy host
Reply With Quote
  #5  
Old 03-01-2006, 01:34 PM
Zachariah's Avatar
Zachariah Zachariah is offline
 
Join Date: Feb 2002
Location: Canoga Park, CA
Posts: 2,125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 03-01-2006, 01:35 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:16 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03588 seconds
  • Memory Usage 2,209KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete