Previous Thread
Next Thread
Print Thread
Hop To
#31709 03/23/2003 11:49 AM
Anonymous
Unregistered
Anonymous
Unregistered
NB! This is a bit on the long side.

Ubb.threads 6.2.3
Xserve 2Gb RAM, 2 * 1 Ghz processors.
-------
We are running a number of UBB classic sites (10) off a largish SUN box, and we are now in the process of moving these to a new server (a Xserve is anyone is interested) running UBB.threads.

This has proven to be a interesting experience, as these boards are reasonably large, the first one had around 40.000 registered users, and a few hundred thousand messages, with around 100.000 pageviews per day for this one alone.

After tuning MySQL the board ran at a reasonable speed, but adding the second board slowed things down considerably.

Again we tuned the boards by only showing categries on the "main view" page, tracing new messsages only in thread view etc, all the stuff we found on the support boards. It all helped, but not enough.

Further digging has lead me to what I consider a design problem - and I am interested in others opinions on how to fix this.

On the second board, with 9000 registered users all tracking shows me that the most heavily requested page is the "main view" page, so I concentrated on this.

Turning on debug info in the footers, and adding &debug=1 shows me that one specific query takes up a little less than half of all database query time on this page. - and the most frequent query in the processlist. The query is

"
Query: SELECT U_Username , U_Number FROM mojo_Users WHERE U_Approved='yes' ORDER BY U_Number DESC LIMIT 0 , 1 "

Looking at this querey with "SHOW PROCESSLIST" gives the following information

"Query: SELECT U_Username , U_Number FROM mojo_Users WHERE U_Approved='yes' ORDER BY U_Number DESC LIMIT 0 , 1
table ,type ,possible_keys ,key ,key_len ,ref ,rows ,Extra
mojo_Users ,range ,App_ndx ,App_ndx ,9,7846 ,where used; Using filesort "
Query took a total of 0.698 seconds. " - this out of 2.2 seconds, probably due to the combinations of a full table scan, the number of hits, and the filesort of these, all to get one users name.

After looking at the source this query is used to find the name of the boards newest user.

I am now getting worried, as this query seems to be extremely inefficient, and as far as I can see it will only consume more and more time as the number of users increase, ie. it's not scaleable, and serves a not terribly important function (IMHO).

All stats from the server indicates that it is CPU bound, (and MySQL bound) at this time, no problems with disk/swapping etc.

---
I can see 3 options for handling this :

1. Rewrite the query (a big job, and a pain every time we upgrade the UBB code).

2. Chop out this query and its results from the "main view"

3. Upgrade MySQL to version 4, where the query cache in theory could speed up the query considerably.

But before I do anything - any views on this from other users? (Especially the MySQL upgrade one)

Tor-Arne Gisvold

#31710 03/24/2003 10:40 AM
Anonymous
Unregistered
Anonymous
Unregistered
I have a partial answer to my own questions - upgraded MySQL to version 4.0.12, and the speed increase (probably due to the query cache) is phenomenal!

#31711 03/25/2003 5:29 AM
Anonymous
Unregistered
Anonymous
Unregistered
We use MySQL 4.x since version 4.0.9 on our production board. The speed increased dramatically, even without using the query cache.

Rewritung the query is not easy. To avoid a full table scan, you'll probably have to store the lastest sign up into a extra data-field.

My experience is, that the search function is the bottleneck on large boards. We currently have about 900.000 postings in our database. Submitting several full table scan queries can bring the hole db down.

We restricted the search options an rewrote the search queries to use the UNION statement. We want to use the fulltext search feature, but we haven't finished testing that, yet.


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
spam issues
by ECNet - 03/19/2024 11:45 PM
Who's Online Now
2 members (ahmed047, Nightcrawler), 614 guests, and 130 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)