Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
bfarber Posted January 16, 2007 Posted January 16, 2007 Hello, To drop the indexes at command line you'd run ALTER TABLE (tablename) DROP INDEX (indexname) i.e. ALTER TABLE ibf_posts DROP INDEX post Then run this to create the index (might have to doublecheck the query syntax, I'm just typing this off the top of my head) ALTER TABLE ibf_posts ADD FULLTEXT INDEX (post) This will take a long time (this particular index is a fulltext index on the post column in your ibf_posts table). As for the queries in the slow query log, IIRC the one showing up the most in your first paste is not used any longer in 2.2 because there's no way to optimize it any further. I believe that's the query (IIRC, it's the "favorite forums" feature in each member's profile)SELECT count(*) as count FROM ibf_posts p LEFT JOIN ibf_topics t ON (p.topic_id=t.tid AND t.approved=1) WHERE p.queued=0 AND t.forum_id IN(9,10,11,24,23,26,37,18,25,15,14,6,31,36,21,28,39,35) AND p.author_id=1592; As for other queries, the best thing that can be done is run them from the command line with the word explain in front of them (only select queries I'd worry about) to see what it's reporting. Is it using an index? How many rows does it see (and does that sound about right)? If you analyze the table and run the same explain query again, is it seeing the same thing? If not, then the table needed to be analyzed - this happens from time to time. In some of the tables there are multi-column indexes (i.e. in the ibf_topics table) - some of the multi-column indexes use the same columns. This is normal, and you should ignore the warning (the indexes themselves are different and shouldn't cause a problem with the mysql optimizer). The ibf_topicviews table does not need an index - there is only one or two columns in it and there is no where clause used when selecting from this table.
MarcusInMd Posted January 16, 2007 Posted January 16, 2007 Thanks for the reply. What I did before reading this post was EXPORT the entire database out to a text file and then reimported it dropping the table as it did its importing. The last time I only did this with the post table. So far so good. We had 535 members online at once today and our load was below 3 the entire time. I did not mention but I wrote several scripts to read a folder on the server and display the contents of that folder (only speciifc files that I was looking for) and the display that output as a web page. The problem is 3 to 4 hundred people were hitting this script at the same time may, many times. And I believe that this might also have played a role. I am changing my script to run once per minute and output the results to a web page consisting of only html code that the users will be viewing. If I run into further problems I will try the above drop indexes on the post and topic tables and then recreate them.
MarcusInMd Posted February 6, 2007 Posted February 6, 2007 Well, I am about to now drop the table indexes and recreate them. <sigh> I am in the planning stages for adding one and perhaps two additional colo servers for our forum. I just don't think that IPB can deal with the kind of traffic we see on a single server solution. We are not hitting the swap but I noticed last night that our iowait is starting to go up now under heavier traffic. Like what I will do is get a higher end database server in a raid 5 config with 15k scsi drives and another lower end server just to serve out images. That will give us three servers each one removing some of the load from the more intensive tasks. While some here say they can get close to 1000 users online at once with IPB with a similar configuration to ours I just don't believe that they have the kind of load pattern that we do. We have 400 or 500 members hitting one thread often times and peopel refreshing constantly as well as maybe 20 or 30 posting in that thread at the same time along with many, many images being uploaded or linked in the same threads. It's just a different beast. But in the end I will give the index drop a chance and then probably start pruning some of our older OT threads from about 2 years ago. Any other ideas?
rct2·com Posted February 7, 2007 Posted February 7, 2007 Would you care to share your my.cnf and httpd.conf files with us please?
MarcusInMd Posted February 7, 2007 Posted February 7, 2007 Would you care to share your my.cnf and httpd.conf files with us please? Sure thing...I spent tons and tons of time tweaking these settings based on reading from all locations. Because we have so much RAM on this server that basically went unused and after reading about creating a very large key buffer size (I set ours to 900mb to try to capture all of our database indexes into ram.)# you will save yourself a lot of trouble. # # Do NOT add a slash at the end of the directory path. # ServerRoot "/etc/httpd" # # PidFile: The file in which the server should record its process # identification number when it starts. # PidFile run/httpd.pid # # Timeout: The number of seconds before receives and sends time out. # Timeout 120 # # KeepAlive: Whether or not to allow persistent connections (more than # one request per connection). Set to "Off" to deactivate. # KeepAlive Off # # MaxKeepAliveRequests: The maximum number of requests to allow # during a persistent connection. Set to 0 to allow an unlimited amount. # We recommend you leave this number high, for maximum performance. # MaxKeepAliveRequests 100 # # KeepAliveTimeout: Number of seconds to wait for the next request from the # same client on the same connection. # KeepAliveTimeout 2 ## ## Server-Pool Size Regulation (MPM specific) ## # prefork MPM # StartServers: number of server processes to start # MinSpareServers: minimum number of server processes which are kept spare # MaxSpareServers: maximum number of server processes which are kept spare # ServerLimit: maximum value for MaxClients for the lifetime of the server # MaxClients: maximum number of server processes allowed to start # MaxRequestsPerChild: maximum number of requests a server process serves <IfModule prefork.c> #StartServers 8 #MinSpareServers 5 #MaxSpareServers 20 #ServerLimit 256 #MaxClients 256 #MaxRequestsPerChild 4000 StartServers 8 MinSpareServers 5 MaxSpareServers 20 ServerLimit 256 MaxClients 32 MaxRequestsPerChild 1000 </IfModule> # worker MPM # StartServers: initial number of server processes to start # MaxClients: maximum number of simultaneous client connections # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # ThreadsPerChild: constant number of worker threads in each server process # MaxRequestsPerChild: maximum number of requests a server process serves <IfModule worker.c> #StartServers 2 #MaxClients 150 #MinSpareThreads 25 #MaxSpareThreads 75 #ThreadsPerChild 25 #MaxRequestsPerChild 0 StartServers 2 MaxClients 32 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 1000 </IfModule> # # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, in addition to the default. See also the <VirtualHost> # directive. # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses (0.0.0.0) # #Listen 12.34.56.78:80 Listen 80[mysqld] long_query_time=1 log-slow-queries=/var/log/mysql-slow.log datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock old_passwords=1 skip-locking #skip-innodb query_cache_limit=1M query_cache_size=32M query_cache_type=1 max_connections=200 interactive_timeout=100 wait_timeout=100 connect_timeout=10 #thread_cache_size=128 key_buffer_size=900M join_buffer=1M max_allowed_packet=16M #table_cache=1024 table_cache=384 record_buffer=1M #sort_buffer_size=2M sort_buffer_size=768K #read_buffer_size=2M read_buffer_size=512K max_connect_errors=10 # Try number of CPU's*2 for thread_concurrency thread_concurrency=4 myisam_sort_buffer_size=64M #log-bin server-id=1 thread_cache_size=50 read_rnd_buffer_size=512K [mysql.server] user=mysql basedir=/var/lib [safe_mysqld] err-log=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid open_files_limit=8192 [mysqldump] quick max_allowed_packet=16M [mysql] no-auto-rehash #safe-updates [isamchk] #key_buffer=64M key_buffer=40M sort_buffer=64M read_buffer=16M write_buffer=16M [myisamchk] key_buffer=64M sort_buffer=64M read_buffer=16M write_buffer=16M [mysqlhotcopy] interactive-timeout Incidently, We have not had catastrophic server load issues but we have approached a load of 20 several times with about 650 users online at once. This is AFTER I exported and reimported the entire IPB database. When things get crazy now I have been disabling search and also turning off the members reading the forum/members reading a topic which seems to help a little bit on the load side. When things get busy around model time our load jumps to about 4 to 6 and as high as 10 when these features are disabled. But I want our forums to have access to all of the features that IPB has to offer.
rct2·com Posted February 7, 2007 Posted February 7, 2007 Sure thing...I spent tons and tons of time tweaking these settings based on reading from all locations. Because we have so much RAM on this server that basically went unused and after reading about creating a very large key buffer size (I set ours to 900mb to try to capture all of our database indexes into ram.) One of the reasons so little RAM is being used is because your httpd.conf MaxClients setting appears to be much too low. This limits the number of instances of Apache that can be loaded into memory to 32. Each instance of Apache serves one simultaneous connection. I'd imagine with hundreds of users on line, you have more than 32 sometimes. Seems a shame not to make best use of the memory. It's possible that with MaxClients low, and users being qued, that this could add to iowait, but that is beyond the boundaries of my knowledge, and frankly, I doubt it. You should be able to reasonably safely set this to (Physical memory in megabytes)/(size of httpd process in megabytes). From http://httpd.apache.org/docs/2.2/misc/perf-tuning.htmlYou can, and should, control the MaxClients setting so that your server does not spawn so many children it starts swapping. This procedure for doing this is simple: determine the size of your average Apache process, by looking at your process list via a tool such as top, and divide this into your total available memory, leaving some room for other processes. On my server, an Apache process is around 16MB, and with 512MB I comfortably run MaxClients=32 (peak users on line is around 350). But I also have MySQL process occupying only 24MB memory. And with your MySQLd running with 900MB key buffer size, you will have to factor that into your MaxClients setting. As you say, the top listing (miles above) shows no evidence of paging, [which is good], the server load is low too, so why the server is in such a high iowait state is puzzling. If it's not SQL, what other scripts on your server could be hammering the disk so hard? Could you post a top listing during an average load? The one you posted a while ago was from your test server. I don't recall, did you say what processor and OS you are running?
MarcusInMd Posted February 7, 2007 Posted February 7, 2007 top - 21:32:49 up 2 days, 16:17, 1 user, load average: 3.00, 3.16, 2.87 Tasks: 164 total, 1 running, 163 sleeping, 0 stopped, 0 zombie Cpu(s): 9.5% us, 1.8% sy, 0.0% ni, 88.4% id, 0.2% wa, 0.0% hi, 0.2% si Mem: 3994580k total, 3943936k used, 50644k free, 75424k buffers Swap: 2031608k total, 8184k used, 2023424k free, 2186008k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 19438 apache 16 0 190m 19m 7744 S 6.6 0.5 0:02.54 httpd 18894 apache 15 0 190m 21m 9420 S 5.0 0.6 0:04.28 httpd 18689 apache 15 0 190m 20m 8544 S 4.0 0.5 0:04.47 httpd 19819 apache 15 0 190m 19m 7920 S 3.0 0.5 0:00.53 httpd 2313 mysql 15 0 1090m 325m 4972 S 1.7 8.3 172:17.29 mysqld 19456 apache 15 0 190m 21m 9500 S 1.3 0.5 0:01.92 httpd 18157 apache 15 0 190m 22m 10m S 0.3 0.6 0:05.50 httpd 18379 apache 15 0 190m 23m 11m S 0.3 0.6 0:05.85 httpd 19394 apache 15 0 190m 21m 9180 S 0.3 0.5 0:01.51 httpd 1 root 16 0 4880 600 500 S 0.0 0.0 0:00.66 init 2 root RT 0 0 0 0 S 0.0 0.0 0:00.45 migration/0 3 root 34 19 0 0 0 S 0.0 0.0 0:00.10 ksoftirqd/0 4 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0 5 root RT 0 0 0 0 S 0.0 0.0 0:02.75 migration/1 6 root 34 19 0 0 0 S 0.0 0.0 0:00.04 ksoftirqd/1 7 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/1 8 root 10 -5 0 0 0 S 0.0 0.0 0:00.01 events/0 This is with 405 users online. All board features are operational. (Please disregard the swap usage - as you can see we still have free memory at the moment. - The swap was hit briefly during the servers daily maint early in the morning) This server is a dual opteron 242 with 4gb of ram. RAID 1 with a 3ware 9500 card running two 10k RPM raptor drives. Running fedora core 4 64bit with the latest kernel. I just recently noticed our IOWAIT coming up some. Last week it was a non issue though. I am more concerned with the servers load jumping up.
rct2·com Posted February 7, 2007 Posted February 7, 2007 For the record, it's a bit easier to read terminal output if you use the 'code' tag rather than the 'quote' tag. Thus:top - 21:32:49 up 2 days, 16:17, 1 user, load average: 3.00, 3.16, 2.87 Tasks: 164 total, 1 running, 163 sleeping, 0 stopped, 0 zombie Cpu(s): 9.5% us, 1.8% sy, 0.0% ni, 88.4% id, 0.2% wa, 0.0% hi, 0.2% si Mem: 3994580k total, 3943936k used, 50644k free, 75424k buffers Swap: 2031608k total, 8184k used, 2023424k free, 2186008k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 19438 apache 16 0 190m 19m 7744 S 6.6 0.5 0:02.54 httpd 18894 apache 15 0 190m 21m 9420 S 5.0 0.6 0:04.28 httpd 18689 apache 15 0 190m 20m 8544 S 4.0 0.5 0:04.47 httpd 19819 apache 15 0 190m 19m 7920 S 3.0 0.5 0:00.53 httpd 2313 mysql 15 0 1090m 325m 4972 S 1.7 8.3 172:17.29 mysqld 19456 apache 15 0 190m 21m 9500 S 1.3 0.5 0:01.92 httpd 18157 apache 15 0 190m 22m 10m S 0.3 0.6 0:05.50 httpd 18379 apache 15 0 190m 23m 11m S 0.3 0.6 0:05.85 httpd 19394 apache 15 0 190m 21m 9180 S 0.3 0.5 0:01.51 httpd 1 root 16 0 4880 600 500 S 0.0 0.0 0:00.66 init 2 root RT 0 0 0 0 S 0.0 0.0 0:00.45 migration/0 3 root 34 19 0 0 0 S 0.0 0.0 0:00.10 ksoftirqd/0 4 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0 5 root RT 0 0 0 0 S 0.0 0.0 0:02.75 migration/1 6 root 34 19 0 0 0 S 0.0 0.0 0:00.04 ksoftirqd/1 7 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/1 8 root 10 -5 0 0 0 S 0.0 0.0 0:00.01 events/0 My gut feel here is that this is related to the amount of memory the queuing processes are asking for when they want to start. They must have a certain minimum to load and start running. Your MySQL and httpd memory occupancy is very high. 16M httpd and 40M MySQL is more typical. I would also expect to see many more httpd and mysqld processes running if there were 450 users on line. So I think that the processes are not being allowed to start because of lack of free memory to load them into, and because they are waiting to start, the load goes up. There are many interpretations of 'load' and mine is that it is processes running + processes waiting to run. Reference: http://www.teamquest.com/resources/gunther...lay/5/index.htm It's quite possible to have very high load and very low CPU utilisation for example., because there a lot of processes waiting rather than running. I am NO expert in this area, but I would take a look at your Apache build (why does it need so much memory), and turning down the wick on your MySQL startup requirements for all those indexes in memory. I don't want to drive you away from here either, but boards for *NIX sysadmins are going to be places where you will get much better help for this kind of problem IMHO. ;)
.CMANNS Posted February 7, 2007 Posted February 7, 2007 Lighttpd ftw. I went from 4-15% load or so to .50
MarcusInMd Posted February 7, 2007 Posted February 7, 2007 For the record, it's a bit easier to read terminal output if you use the 'code' tag rather than the 'quote' tag. Thus:top - 21:32:49 up 2 days, 16:17, 1 user, load average: 3.00, 3.16, 2.87 Tasks: 164 total, 1 running, 163 sleeping, 0 stopped, 0 zombie Cpu(s): 9.5% us, 1.8% sy, 0.0% ni, 88.4% id, 0.2% wa, 0.0% hi, 0.2% si Mem: 3994580k total, 3943936k used, 50644k free, 75424k buffers Swap: 2031608k total, 8184k used, 2023424k free, 2186008k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 19438 apache 16 0 190m 19m 7744 S 6.6 0.5 0:02.54 httpd 18894 apache 15 0 190m 21m 9420 S 5.0 0.6 0:04.28 httpd 18689 apache 15 0 190m 20m 8544 S 4.0 0.5 0:04.47 httpd 19819 apache 15 0 190m 19m 7920 S 3.0 0.5 0:00.53 httpd 2313 mysql 15 0 1090m 325m 4972 S 1.7 8.3 172:17.29 mysqld 19456 apache 15 0 190m 21m 9500 S 1.3 0.5 0:01.92 httpd 18157 apache 15 0 190m 22m 10m S 0.3 0.6 0:05.50 httpd 18379 apache 15 0 190m 23m 11m S 0.3 0.6 0:05.85 httpd 19394 apache 15 0 190m 21m 9180 S 0.3 0.5 0:01.51 httpd 1 root 16 0 4880 600 500 S 0.0 0.0 0:00.66 init 2 root RT 0 0 0 0 S 0.0 0.0 0:00.45 migration/0 3 root 34 19 0 0 0 S 0.0 0.0 0:00.10 ksoftirqd/0 4 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0 5 root RT 0 0 0 0 S 0.0 0.0 0:02.75 migration/1 6 root 34 19 0 0 0 S 0.0 0.0 0:00.04 ksoftirqd/1 7 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/1 8 root 10 -5 0 0 0 S 0.0 0.0 0:00.01 events/0 My gut feel here is that this is related to the amount of memory the queuing processes are asking for when they want to start. They must have a certain minimum to load and start running. Your MySQL and httpd memory occupancy is very high. 16M httpd and 40M MySQL is more typical. I would also expect to see many more httpd and mysqld processes running if there were 450 users on line. So I think that the processes are not being allowed to start because of lack of free memory to load them into, and because they are waiting to start, the load goes up. There are many interpretations of 'load' and mine is that it is processes running + processes waiting to run. Reference: http://www.teamquest.com/resources/gunther...lay/5/index.htm It's quite possible to have very high load and very low CPU utilisation for example., because there a lot of processes waiting rather than running. I am NO expert in this area, but I would take a look at your Apache build (why does it need so much memory), and turning down the wick on your MySQL startup requirements for all those indexes in memory. I don't want to drive you away from here either, but boards for *NIX sysadmins are going to be places where you will get much better help for this kind of problem IMHO. ;) Thanks. When we get up near 600 users or so there certainly are more httpd processes running. I have read tons on apache and mysql settings and the above configs are the best I could come up with. I have even had swsoft (who makes plesk which is my systems CP) in the box and they thought everything was setup OK. I then had a liunx "pro" login and he thought things looked OK as well. Any ideas on getting httpd processes to reduce the amount of memory that each process is using? Thanks again.Lighttpd ftw. I went from 4-15% load or so to .50 How many users do you typically have online at once? Also, I am not sure this is an option for us because of the integration of Plesk CP with a custom version of apache.
rct2·com Posted February 8, 2007 Posted February 8, 2007 I think if you've had swsoft and a 'pro' then there's little I could add with my limited knowledge of Apache and less knowledge of MySQL tuning. All I can say by way of comparison is that we have a baby server compared to you. A dedicated server Celeron 2.4GHz, RHEL v3, 512MB memory, a single IDE 80GB hard disk and a single ethernet interface. Running 14 sites, but 2 big IPB sites, the heaviest load we see is around 14 (which is just about tolerable) when there are around 300 visitors browsing an IPB v2.1.7, with a second site running IPB v2.1.7 having about 20 visitors at the same time. Monthly bandwidth is about 100GB. We also run PLESK v7.5.4, and used the Apache and MySQL configs out of the box from our host (ThePlanet), but tweaked Apache MaxClients down to 32 and PHP initial memory up to 16M. FC4 of course is 'beta' software. Could that be a factor?
MarcusInMd Posted February 9, 2007 Posted February 9, 2007 I think if you've had swsoft and a 'pro' then there's little I could add with my limited knowledge of Apache and less knowledge of MySQL tuning. All I can say by way of comparison is that we have a baby server compared to you. A dedicated server Celeron 2.4GHz, RHEL v3, 512MB memory, a single IDE 80GB hard disk and a single ethernet interface. Running 14 sites, but 2 big IPB sites, the heaviest load we see is around 14 (which is just about tolerable) when there are around 300 visitors browsing an IPB v2.1.7, with a second site running IPB v2.1.7 having about 20 visitors at the same time. Monthly bandwidth is about 100GB. We also run PLESK v7.5.4, and used the Apache and MySQL configs out of the box from our host (ThePlanet), but tweaked Apache MaxClients down to 32 and PHP initial memory up to 16M. FC4 of course is 'beta' software. Could that be a factor? We typically push about 400gb/month through our server. I kick up the maxclients yesterday to 100 and the load seemed to stablize well below 10. I will continue to mess around with this. Our server is leaps and bounds above what you have and you wouild think we would be able to handle much much more. Actually it makes me kinda sick to the stomach to think that we get the performance that we do with all of the extra ram, powerful raid hardware and disks and the CPU power and you have a celeron that rivals our performace at this time....Geeze!! LOL I am convinced that we are close to needing more in the way of servers. I plan to break off the database services to a dedicated server sometime soon to see if it helps more. I still think our issue is the sheer volume of activity. When we have 600+ on they are hitting the threads hard. I don't think FC4 is the issue but I guess anything is possible. Thanks for your help!
MarcusInMd Posted February 9, 2007 Posted February 9, 2007 453 user(s) active in the past 15 minutes Right now our server load is .68 So it really depends on what these people are doing while online with the forum.
Fast Lane! Posted February 9, 2007 Posted February 9, 2007 The search function seriously causes massive server spikes and is more likely to do this when the server is loaded more than normal. I wrote something that will disable the search function when the server load exceeds a certain amount and thus help mitigate the chance that you will get a bunch of locked tables due to a slow search (and then make the server load even higher).http://forums.invisionpower.com/index.php?showtopic=232336
MarcusInMd Posted February 9, 2007 Posted February 9, 2007 Fastlane, Thanks. That looks useful. I have wondered about the search function and have disabled it from time to time and sometimes it helps and other times it does not. But I will install that feature. I get sick of turning it off and on. LOL. BTW, I have tested with that many users online and our search is instant. so I guess maybe it has more to do with the load AND the search(s) being conducted.
Fast Lane! Posted February 9, 2007 Posted February 9, 2007 Yeah. Make sure my code to get the server load works on your server. It may be specific to mine. Just put the code in a blank page and then put the line: echo $serverload; at the end. It should output the one minute load if it is working. If not you might have to find a different way to record your server load.
MarcusInMd Posted February 9, 2007 Posted February 9, 2007 We are still on IPB 2.1.7. Your code looks different. Is this for an earlier or newer version of IPB?
Fast Lane! Posted February 9, 2007 Posted February 9, 2007 Basically at the very top of the search.php you will see a portion that escapes out of the search if the user does not have permission to search or if the search function is disabled. You basically can duplicate one of those if statements and replace the condition with the serverload comparision. For 2.1.7 (I have not tested for this version as I use 2.2.1) edit sources/action_public/search.php as follows: find:if (! $this->ipsclass->vars['allow_search']) { $this->ipsclass->Error( array( LEVEL => 1, MSG => 'search_off') ); } and place above it:$top_com = "top -n 1 -b"; $top = trim(`$top_com`); $pattern = "/^.*\b(average)\b.*$/mi"; preg_match($pattern, $top, $hits); $loadline = $hits[0]; $load_bits = explode("average:",$loadline); $load_parts = explode(",",$load_bits[1]); $serverload = trim($load_parts[0]); //equals one minute server load average $serverload_limit = 2.5; //define load maximum to allow search if ($serverload > $serverload_limit) { $this->ipsclass->Error( array( LEVEL => 1, MSG => 'search_off') ); } For 2.2.1 edit sources/action_public/search.php as follows: Find:if (! $this->ipsclass->vars['allow_search']) { if ( $this->xml_out ) { @header( "Content-type: text/html;charset={$this->ipsclass->vars['gb_char_set']}" ); print $this->ipsclass->lang['search_off']; exit(); } else { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'search_off') ); } } and add above it:$top_com = "top -n 1 -b"; $top = trim(`$top_com`); $pattern = "/^.*\b(average)\b.*$/mi"; preg_match($pattern, $top, $hits); $loadline = $hits[0]; $load_bits = explode("average:",$loadline); $load_parts = explode(",",$load_bits[1]); $serverload = trim($load_parts[0]); //equals one minute server load average $serverload_limit = 2.5; //define load maximum to allow search if ($serverload > $serverload_limit) { if ( $this->xml_out ) { @header( "Content-type: text/html;charset={$this->ipsclass->vars['gb_char_set']}" ); print "Server Load is too high now. The Search Feature is offline and will return shortly. Thank you for understanding."; exit(); } else { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'search_off') ); } }
Fast Lane! Posted February 9, 2007 Posted February 9, 2007 What is your hardware like? CentOS (linux).
MarcusInMd Posted February 9, 2007 Posted February 9, 2007 This works well. But I don't get your message I get this:The error returned was: Sorry, the administrator has taken the search engine offline for the moment. Please try again later It appears to be the softwares default message for the search.
.CMANNS Posted February 9, 2007 Posted February 9, 2007 Thanks. When we get up near 600 users or so there certainly are more httpd processes running. I have read tons on apache and mysql settings and the above configs are the best I could come up with. I have even had swsoft (who makes plesk which is my systems CP) in the box and they thought everything was setup OK. I then had a liunx "pro" login and he thought things looked OK as well. Any ideas on getting httpd processes to reduce the amount of memory that each process is using? Thanks again. How many users do you typically have online at once? Also, I am not sure this is an option for us because of the integration of Plesk CP with a custom version of apache. you can run mod_proxy with lighttpd and apafaeces I had 3 forums om my server, 2 with over 200users on often and 1-2 small forums with up to 10 members on. Pm'ed you
Fast Lane! Posted February 9, 2007 Posted February 9, 2007 This works well. But I don't get your message I get this: It appears to be the softwares default message for the search. That is normal. The message I wrote was for the XML condition which I do not fully understand however I needed to have it there. You are getting the "$this->ipsclass->lang['search_off']" message. If you want to edit that and place text in there instead you could do that. Either way it looks like it is working on your server. You can test it by lowering the threshold for the server load and make sure it prevents searches.
.CMANNS Posted February 9, 2007 Posted February 9, 2007 CentOS (linux). One of the best server OS's. Either watered down RHEL or Centos.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.