4

How to improve the speed of askbot?

I installed askbot and deployed under nginx, using the instructions in the wiki. (Aside: Is the wiki maintained? I didn't find a link from the main askbot site, only from google?)

I have gzip compression enabled with nginx.

This is a fresh VPS with little running on it and 0 load.

However, load time is quite slow, even after I load the home page once or twice to cache it. (Is there caching?)

According to pingdom, it takes a full 1.84 seconds to load the front page and all assets.

The django request takes 250 ms. This is the connect time, not the DNS lookup or send time.

Also, I see that loading many separate javascript files takes a lot of time, which could be reduced by using a Django app for compressing and minifying the javascript into one asset.

What else could I be doing wrong? Why is a fresh askbot on a fresh VPS taking 1.84 seconds to load?

Joseph's avatar
353
Joseph
updated 2011-11-16 03:32:54 -0600, asked 2011-11-16 03:26:52 -0600
edit flag offensive 0 remove flag close merge delete

Comments

Joseph, sorry the wiki is not maintained, we use it only for the development docs. I will delete a number of older documents from there. Unfortunately wiki is hard to keep in sync with the software being in the repo.

Evgeny's avatar Evgeny (2011-11-17 09:52:59 -0600) edit
add a comment see more comments

3 Answers

2

Askbot asks for a lot of files (9 javascript files, 3 style sheets, 12 images for the title page...), so configuring caching and expiration headers in your nginx installation is important.

That still doesn't solve the issue with first-hit loads, of course. Like you say, a bundling approach for static files would help a lot here, reducing the number of HTTP requests.

That's the low hanging fruit; the insides of askbot can surely be optimized as well, but I truly believe Evgeny should concentrate on fixing more important stuff first, and consolidating the documentation...

piskvorky's avatar
350
piskvorky
answered 2011-11-16 19:02:59 -0600
edit flag offensive 0 remove flag delete link

Comments

Thanks, we've been focusing on perhaps too many things lately. Will be happy to hear your opinion.

Evgeny's avatar Evgeny (2011-11-17 07:51:10 -0600) edit
add a comment see more comments
1

It is because on the first hit you compile the application, subsequent requests must be a lot faster. Regarding the media files - if you serve them directly by the webserver they will arrive a lot faster.

However - if the delay is recurring - is must be because of deployment issues like serving media files through python or your vps swapping memory.

Evgeny's avatar
13.2k
Evgeny
answered 2011-11-16 06:40:28 -0600
edit flag offensive 0 remove flag delete link

Comments

Also DEBUG = True can make things a bit slower.

Fitoria's avatar Fitoria (2011-11-16 07:58:28 -0600) edit

DEBUG = False

Joseph's avatar Joseph (2011-11-16 14:29:30 -0600) edit

Also, this is not the first hit. Check out my quesiton again: I reload it once or twice to get these timings. Is there Django caching in askbot?

Joseph's avatar Joseph (2011-11-16 14:30:51 -0600) edit

Load is 0. and I have 800 MB of free memory (no swapping).

Joseph's avatar Joseph (2011-11-16 14:31:14 -0600) edit
add a comment see more comments
1

It turns out that if you through askbot behind a free cloudflare plan, and set up aggressive caching, you can easily get latency down to 200ms.

Joseph's avatar
353
Joseph
answered 2012-07-24 04:49:44 -0600
edit flag offensive 0 remove flag delete link

Comments

We've made some improvements since last year, there is room left still.

Evgeny's avatar Evgeny (2012-07-24 05:42:08 -0600) edit

Cloudflare free plans are actually pretty cool: They automatically cache static content. They combine and minify js and css. They convert all JS to asynchronous JS. They monitor against spiders and throw up captchas if someone looks like a spammer.

Joseph's avatar Joseph (2012-07-24 16:23:18 -0600) edit
1

I am playing around with cloudflare to see if the aggressive acceleration settings (which are still in beta) break anything. I turned on "Rocket Loaderâ„¢ (Web optimization) (Beta) Automatically asynchronously load all JavaScript resources." which speed up rendering quite noticeably. It would be cool if askbot docs could make recommendations about what cloudflare settings are safe for use, because it is so easy to set up and makes a large difference. So I'm testing it.

Joseph's avatar Joseph (2012-07-24 16:25:34 -0600) edit
add a comment see more comments