1
mouacy
max_questions resource problem
  • 2005/2/8 22:45

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


hey guys, how do solve a problem that has to do with max_question resource?

2
m0nty
Re: max_questions resource problem
  • 2005/2/8 22:51

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


dunno, maybe someone might tell you if you provide more details as to what exactly your problem is or what exactly it is you want to know :S be specific and give as much info as possible..

3
toddherrold
Re: max_questions resource problem

I have a SQL database max_questions resource problem also. So, I will try to give as much info as possible.

My site regularly goes down and leads to a blank page. I first noticed this when I was making a lot of changes to the site and uploading lots of database tables. Apparently, my web host limits the number of database queries over some unknown time frame to 50000. Sometimes the site will go down for just a few minutes, and other times for up to one hour when this limit has been reached. The error max_questions error shows up when the site is down and I log into phpMyAdmin. The databases that normally show up, do not, and an SQL error message shows up indicating that the max_questions limit of 50K has been reached. The webhost told me that this will always reset within an hour.

This first showed up as only a problem when I was doing extensive upgrading of modules or database tables and running a lot of queries. But now the problem shows up repeatedly and on a daily basis even when no extensive database changes or site development is happening. My site has recently been receiving more user and robot activity, but it is still very low traffic on average, receiving a max of 3000 unique visits a day. Hits on on the order of 100K per day. Still, I feel either the limit of 50K queries is low, or for some reason XOOPS is running a lot of database activity upon page loading that may not be necessary.

Thoughts?

4
Dave_L
Re: max_questions resource problem
  • 2005/3/20 21:19

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


I was helping a friend with the same problem (max_questions limit hit). He's using phpnuke, not XOOPS.

I added some code to log all the database queries, along with the IP address and user agent.

It turned out that the bulk of the hits were from Google's bot: HTTP_USER_AGENT = Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html).

5
mouacy
Re: max_questions resource problem
  • 2005/3/21 1:23

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


Quote:

Dave_L wrote:
It turned out that the bulk of the hits were from Google's bot: HTTP_USER_AGENT = Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html).


Yeah. I found out the same problem with my site. I receive more google hits than any other visitors. So I disabled many modules in the robot.txt file in the root directory and now my site seems work a lot better.

6
toddherrold
Re: max_questions resource problem

yes. i too have a lot of google hits. I also found in other threads here that it helps to optimize the use of module and block caching. my site did not have any caching on blocks or modules. So, I configured those appropriately and am going to see if this helps.

I received the following message from my web host in regard to this proglem:

Quote:
You are getting 'max_questions' error, because your script is not closing the connection when a request is finished. This is typical of the scripts out there this limit is hourly, so every hour it should reset, you are using resources more than 50,000 and this is causing the error. So please check the script at your end or we suggest you to signup for the virtual or dedicated server, where you can set your own limits.


Can anyone help me understand what is meant by the script not closing the connection after a request is made and the connection this has to exceeding the limit? I'm a bit unclear on that. Also, does this make sense for XOOPS?

7
toddherrold
Re: max_questions resource problem

Anyone? Does the above quote mean that XOOPS leaves the database connections open so that they eventually add up to 50K and crash the system? Is this true? Is this configurable? And, if so, how? It's very irritating to have the site crash on such a regular basis. I'd love to blame my webhost completely, but something tells me there's more to this story. . .

8
Dave_L
Re: max_questions resource problem
  • 2005/3/31 5:12

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Unless you have persistent connections enabled, the connection gets closed automatically.

A "question" is a query. So that error means you're getting 50000 database queries within the specified time period.

The only way I know to troubleshoot it is to add some code to log all the queries, along with some identifying information (e.g., timestamp, IP address, user agent). Then you would be able to tell whether some particular visitor, such as a robot, is causing the problem, or whether it's just that your site is very busy due to normal traffic.

The problem might be lessened by enabling caching for, or not using, various blocks or modules.

9
Dave_L
Re: max_questions resource problem
  • 2005/3/31 7:36

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Here's a hack you can use to log the afrementioned information.

You'll need to change $logdir to specify the path to a writable directory for the log files. This directory should be protected from viewing from a web browser.

A new log file is created each hour. The log files may take up a lot of disk space, so watch out for that.

class/database/mysqldatabase.php (function XoopsMySQLDatabase::queryF)


[color=ff0000]#*#DEBUG# - start
$logdir  '/example/path'// path to writable directory
$logext  'log'// log file extension
$now     time();
$ymdhms  date('Y-m-d H:i:s'$now);
$ymdh    date('Y-m-d-H'$now);
$sql_q   addcslashes($sql"rnt");
$logfile "$logdir/$ymdh.$logext";
error_log("[$ymdhms] [{$_SERVER["REQUEST_METHOD"]}] [{$_SERVER['REMOTE_ADDR']}] [{$_SERVER['HTTP_USER_AGENT']}] [{$_SERVER["SCRIPT_NAME"]}] [$sql_q]n"3$logfile);
chmod($logfile0666);
#*#DEBUG# - end[/color]
$result =& mysql_query($sql$this->conn);

10
toddherrold
Re: max_questions resource problem

thanks! i'll give it a shot.

Login

Who's Online

253 user(s) are online (115 user(s) are browsing Support Forums)


Members: 0


Guests: 253


more...

Donat-O-Meter

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

Latest GitHub Commits