PDA

View Full Version : vBulletin Guest Cache with LiteSpeed


dihuta
10-21-2010, 10:34 PM
Hello,

IBxAnders've just wrote an Blog entry to guide how to use Varnish for Output Caching for vBulletin Guest Pages (ie. index.php and content.php).

URL: vbulletin.com/forum/entry.php?2440-vB4Mance-Part-5-Expert-Level-Boosting-vBulletin-Performance-with-Advanced-Caching

I see LiteSpeed have a powerfuil Output Caching lite Varnish. But I don't know how to do with LiteSpeed. Could you please help to config this.

Doing this will help much vBulletin Forum Owner can decrease high load by using LiteSpeed mod_cache.

Thank you so much.

NiteWave
01-12-2011, 09:13 AM
Hello dihuta, wish you're still monitoring this thread.

We've tried to cache this vBulletin(litespeed support forum) for guest visits for some days and looks successful so far. Just using the way you mentioned in your post: install a vBulletion plugin first, then using litespeed's unique rewrite+cache function to get it done.

It's far more simple and strait-forward than apache + varnish, we'd discuss/help with our users how to implement it under litespeed.

eva2000
01-12-2011, 12:00 PM
awesome news, get a guide/how to post up for all of us to try so we can provide feedback :D

Guess next popular apps to test this for would be

1. wordpress
2. drupal
3. openx
4. photopost
5. reviewpost

:D

dihuta
01-12-2011, 04:18 PM
It's so great to hear this!
Could you please help me how to do this in step by step?
Can't wait to try this.

Thank you so much.


Hello dihuta, wish you're still monitoring this thread.

We've tried to cache this vBulletin(litespeed support forum) for guest visits for some days and looks successful so far. Just using the way you mentioned in your post: install a vBulletion plugin first, then using litespeed's unique rewrite+cache function to get it done.

It's far more simple and strait-forward than apache + varnish, we'd discuss/help with our users how to implement it under litespeed.

NiteWave
01-12-2011, 06:53 PM
1.install vBulletin plug-in(or "vBulletin Boost Product XML")
product-boostv1.xml‎
please refer the first post in this thread, to get the file's link and download it(currently, it's 657 views)

2.set cache directory
lsws admin console-->Server-->Cache:
Cache Storage Settings->Storage Path:/tmp/diskcache (just for example)

please create this directory in shell:
#mkdir /tmp/diskcache
#chown nobody:nobody /tmp/diskcache
#chmod 700 /tmp/diskcache
(assume litespeed(or lshttpd) process is running as nobody)

3. set vhost's "Cache Policy"
assume vBulletin is natively configured as a lsws vhost "myforum"
lsws admin console->Virtual Hosts->myforum->Cache:
Enable Cache:No
Cache Request with Query String:Yes
Cache Request with Cookie:Yes
Cache Response with Cookie:Yes
Ignore Request Cache-Control:Yes
Ignore Response Cache-Control:Yes

4.use rewriterule to cache php pages which you want to
lsws admin console->Virtual Hosts->myforum->Rewrite:
(assume vBulletin installed in $DOCUMENT_ROOT/forum)

##%## following redirect will reduce cached files:
######## otherwise domain.com/abc.php and www.domain.com/abc.php will create 2 cache files.
RewriteCond %{HTTP_HOST} !^www\.domain\.com$
RewriteRule /forum/(.*)$ http://www.domain.com/forum/$1 [R=301,L]

## select which pages to cache
RewriteCond %{HTTP_COOKIE} !bbimloggedin=yes
RewriteCond %{HTTP_COOKIE} !bbuserid=
RewriteCond %{HTTP_COOKIE} !bbpassword=
RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
RewriteCond %{QUERY_STRING} !s=[a-fA-F0-9]{32}
RewriteCond %{QUERY_STRING} !product=vbnexus
RewriteCond %{REQUEST_URI} !^/forum/(login|register|usercp|private|profile|cron|image) \.php$
RewriteCond %{REQUEST_URI} !^/forum/admincp
RewriteRule /forum/(.*\.php)?$ - [L,E=Cache-Control:max-age=120]
5. restart litespeed

Note: you may need set a cron job to clean up cace directory /tmp/diskcache. following script is borrowed from $SERVER_ROOT/admin/misc/cleancache.sh:
*/10 * * * * root find /tmp/diskcache -type f -mmin +8 -delete 2>/dev/null
delete cache which created 8 minutes ago(running once every 10 minutes). since we set cache expire time as 120 seconds(2 minutes), so it's safe to delete these cache files.

eva2000
01-12-2011, 09:17 PM
What if virtualhost is via apache on whm/cpanel based litespeed server ? Would vbseo rewrites interfere with this ?

thanks

NiteWave
01-12-2011, 09:48 PM
rewriterule has no difference. but need put it in httpd.conf, vhost definition section. it's ok to put the rewriterule in .htaccess as well. just need some minor adjustment, since the per server and per directory rewriterule difference.

dihuta
01-13-2011, 01:10 AM
I have Litespeed + DirectAdmin. There is no vhost item in Virtual Host list. So where exactly to put these lines? (httpd.conf?)

Enable Cache:No
Cache Request with Query String:Yes
Cache Request with Cookie:Yes
Cache Response with Cookie:Yes
Ignore Request Cache-Control:Yes
Ignore Response Cache-Control:Yes


Thank you.

3. set vhost's "Cache Policy"
assume vBulletin is natively configured as a lsws vhost "myforum"
lsws admin console->Virtual Hosts->myforum->Cache:

eva2000
01-13-2011, 07:21 AM
rewriterule has no difference. but need put it in httpd.conf, vhost definition section. it's ok to put the rewriterule in .htaccess as well. just need some minor adjustment, since the per server and per directory rewriterule difference.

thanks

For that rewrite url set, how would it be modified to also exclude individual non-vB php pages i.e.


domain.com/about.php
domain.com/contact.php

or exclude wordpress specific pages/directories

domain.com/wordpress
domain/wp-content/

etc ?

NiteWave
01-13-2011, 08:36 AM
dihuta:
please try same settings at server level in your case, then try rewriterule cache, see if it works.

eva2000:
for wordpress, I think wordpress's plug-in: wp super cache(or w3 total cache?) is better, please use it instead. why? since it generate static pages --- that means, if a post has no update, the static page no update too, the static pages won't expire until the post has update. for litespeed cache, as you can see, have to set a expire time, say 120 seconds, or 600 seconds, etc. after it expires, have to re-generate cache again even the original php page has no change at all.

eva2000
01-13-2011, 09:00 AM
oh my mistake I forgot you have global cache disabled in litespeed above config, as i thought the rewrite rule would cache all php pages which arent excluded by the rewrite rule. But since you have global cached disabled it wouldn't touch other scripts. Pretty neat that you can fine tune what specifically get's cached with global cache disabled :)

eva2000
01-13-2011, 09:20 PM
Hello dihuta, wish you're still monitoring this thread.

We've tried to cache this vBulletin(litespeed support forum) for guest visits for some days and looks successful so far. Just using the way you mentioned in your post: install a vBulletion plugin first, then using litespeed's unique rewrite+cache function to get it done.

It's far more simple and strait-forward than apache + varnish, we'd discuss/help with our users how to implement it under litespeed.

1.install vBulletin plug-in(or "vBulletin Boost Product XML")
product-boostv1.xml‎
please refer the first post in this thread, to get the file's link and download it(currently, it's 657 views)

just to clarify you tried this on vB4.x forum or vB 3.8.6 ?

NiteWave
01-14-2011, 01:05 AM
it's 3.8.4 :)

eva2000
01-14-2011, 02:00 AM
I see, so you uploaded boost.php and installed product-boostv1.xml‎ ?

NiteWave
01-14-2011, 02:22 AM
no need to upload boost.php in litespeed case. boost.php is used to generate varnish cache rules.

eva2000
01-14-2011, 02:25 AM
Okay thanks for the clarification :)

dihuta
01-14-2011, 11:52 PM
These setting conflit with VBSEO.
If I put rewriterute before vbseo rules, VBSEO will not work, vice versa, Cache will not work.

Please help me.
Thank you.

1.install vBulletin plug-in(or "vBulletin Boost Product XML")
product-boostv1.xml‎
please refer the first post in this thread, to get the file's link and download it(currently, it's 657 views)

2.set cache directory
lsws admin console-->Server-->Cache:
Cache Storage Settings->Storage Path:/tmp/diskcache (just for example)

please create this directory in shell:
#mkdir /tmp/diskcache
#chown nobody:nobody /tmp/diskcache
#chmod 700 /tmp/diskcache
(assume litespeed(or lshttpd) process is running as nobody)

3. set vhost's "Cache Policy"
assume vBulletin is natively configured as a lsws vhost "myforum"
lsws admin console->Virtual Hosts->myforum->Cache:
Enable Cache:No
Cache Request with Query String:Yes
Cache Request with Cookie:Yes
Cache Response with Cookie:Yes
Ignore Request Cache-Control:Yes
Ignore Response Cache-Control:Yes

4.use rewriterule to cache php pages which you want to
lsws admin console->Virtual Hosts->myforum->Rewrite:
(assume vBulletin installed in $DOCUMENT_ROOT/forum)


5. restart litespeed

Note: you may need set a cron job to clean up cace directory /tmp/diskcache. following script is borrowed from $SERVER_ROOT/admin/misc/cleancache.sh:
*/10 * * * * root find /tmp/diskcache -type f -mmin +8 -delete 2>/dev/null
delete cache which created 8 minutes ago(running once every 10 minutes). since we set cache expire time as 120 seconds(2 minutes), so it's safe to delete these cache files.

NiteWave
01-15-2011, 03:04 AM
sorry, we may not able to help with vbseo, since this forum haven't installed it. Here we mainly demonstrate lsws's unique rewriterule+cache function, in example of vBulletin which happen to be running as litespeed support forum.

eva2000
01-15-2011, 04:12 AM
dihuta, might want to ask on vbseo by posting on their forums the above litespeed/cache rewrite rules and see where the conflict is ? I believe vbseo has it's own cookies for logged in users called vbseo_loggedin = yes

dihuta
01-15-2011, 05:36 PM
Thanks Eva2000,
I will do it now.


dihuta, might want to ask on vbseo by posting on their forums the above litespeed/cache rewrite rules and see where the conflict is ? I believe vbseo has it's own cookies for logged in users called vbseo_loggedin = yes

eva2000
01-25-2011, 06:27 AM
Update trying this on my local test install vB 3.8.6 PL1 at 192.168.56.101/index.php where user prefix cookie in config.php changed from bb to zz.

Installed product-boostv1.xml‎ from vbulletin.com blog (http://www.vbulletin.com/forum/entry.php/2440-vB4Mance-Part-5-Expert-Level-Boosting-vBulletin-Performance-with-Advanced-Caching)

.htaccess

RewriteEngine on
#RewriteCond %{HTTP_HOST} !^www\.domain\.com$
#RewriteRule /forum/(.*)$ http://www.domain.com/forum/$1 [R=301,L]

RewriteCond %{HTTP_COOKIE} !zzimloggedin=yes
RewriteCond %{HTTP_COOKIE} !zzuserid=
RewriteCond %{HTTP_COOKIE} !zzpassword=
RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
RewriteCond %{QUERY_STRING} !s=[a-fA-F0-9]{32}
RewriteCond %{QUERY_STRING} !product=vbnexus
RewriteCond %{REQUEST_URI} !^/(login|register|usercp|private|profile|cron|image) \.php$
RewriteCond %{REQUEST_URI} !^/admincp
RewriteRule /(.*\.php)?$ - [L,E=Cache-Control:max-age=120]


litespeed 4.0.19 cache policy

Enable Cache:No
Cache Request with Query String:Yes
Cache Request with Cookie:Yes
Cache Response with Cookie:Yes
Ignore Request Cache-Control:Yes
Ignore Response Cache-Control:Yes

apache httpd.conf contains

#disk cache
<IfModule mod_cache.c>
<IfModule mod_disk_cache.c>
CacheRoot /lscache/
#CacheEnable disk /
</IfModule>
</IfModule>

unfortunately not seeing any caching being done ?

index.php

curl -I 192.168.56.101/index.php
HTTP/1.1 200 OK
Date: Tue, 25 Jan 2011 14:20:25 GMT
Server: LiteSpeed
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
X-Powered-By: PHP/5.3.5
Cache-Control: private
Pragma: private
Content-Type: text/html; charset=ISO-8859-1
X-UA-Compatible: IE=7
Set-Cookie: zzlastvisit=1295965225; expires=Wed, 25-Jan-2012 14:20:25 GMT; path=/
Set-Cookie: zzlastactivity=0; expires=Wed, 25-Jan-2012 14:20:25 GMT; path=/
Set-Cookie: zzimloggedin=deleted; expires=Mon, 25-Jan-2010 14:20:24 GMT; path=/

calendar.php

curl -I 192.168.56.101/calendar.php
HTTP/1.1 200 OK
Date: Tue, 25 Jan 2011 14:23:08 GMT
Server: LiteSpeed
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
X-Powered-By: PHP/5.3.5
Cache-Control: private
Pragma: private
Content-Type: text/html; charset=ISO-8859-1
X-UA-Compatible: IE=7
Set-Cookie: zzlastvisit=1295965388; expires=Wed, 25-Jan-2012 14:23:08 GMT; path=/
Set-Cookie: zzlastactivity=0; expires=Wed, 25-Jan-2012 14:23:08 GMT; path=/
Set-Cookie: zzimloggedin=deleted; expires=Mon, 25-Jan-2010 14:23:07 GMT; path=/
Set-Cookie: zzcalendar=73b76532bddaadc3d4641a679a7a864d5465949 3a-1-%7Bs-7-.calyear._i-2011_%7D; path=/
Set-Cookie: zzcalendar=a8c9af9110b7d9bdc2ae7d1b37fbcf3dd53a84b fa-2-%7Bs-7-.calyear._i-2011_s-8-.calmonth._i-1_%7D; path=/
Set-Cookie: zzcalendar=5c26fff35c941f4c0da6757b2b77682c241d1d2 aa-3-%7Bs-7-.calyear._i-2011_s-8-.calmonth._i-1_s-8-.calview1._s-12-.displaymonth._%7D; path=/

[root@localhost lscache]# ls -alhR
.:
total 12K
drwxrwxrwx 2 nobody nobody 4.0K Jan 25 00:09 .
drwxr-xr-x 28 root root 4.0K Jan 25 21:58 ..

Not sure if xml plugin code and vB 3.8.6 PL1 has anything different from litespeed testing this on this forum vB 3.8.4.

NiteWave
01-25-2011, 07:31 AM
Not sure if xml plugin code and vB 3.8.6 PL1 has anything different
please login your vBulletin, see if cookie "zzimloggedin=yes" exist. then logout, check it again.

"curl -I" won't trigger lsws to generate cache. please pull out its content using browser or wget/curl.

eva2000
01-25-2011, 07:51 AM
please login your vBulletin, see if cookie "zzimloggedin=yes" exist. then logout, check it again.

"curl -I" won't trigger lsws to generate cache. please pull out its content using browser or wget/curl.

Yes same in firefox browser logged in zzimloggedin=yes exists. The /lscache isn't populated even for guest viewing via browser. Will try again and see.

mistwang
01-25-2011, 12:05 PM
You can enable rewrite logging, see if the rewrite rule works as expected.

eva2000
01-26-2011, 06:14 AM
Okay as NiteWave requested i tried removing CacheRoot /lscache/ from httpd.conf and only use litespeed admin console set /lscache for cache path and now ndex.php isn't cached but test.php is still cached.

logged out of forums with cookies deleted

index.php firefox firebug reported headers for

index.php

Content-Encoding gzip
Vary Accept-Encoding
Transfer-Encoding chunked
Date Wed, 26 Jan 2011 14:02:32 GMT
Server LiteSpeed
Connection Keep-Alive
Keep-Alive timeout=5, max=100
X-Powered-By PHP/5.3.5
Content-Type text/html; charset=ISO-8859-1
Cache-Control private
Pragma private
Set-Cookie zzlastactivity=0; expires=Thu, 26-Jan-2012 14:02:32 GMT; path=/ zzimloggedin=deleted; expires=Tue, 26-Jan-2010 14:02:31 GMT; path=/



for test.php

Content-Encoding gzip
Vary Accept-Encoding
Date Wed, 26 Jan 2011 14:27:05 GMT
Server LiteSpeed
Connection Keep-Alive
Keep-Alive timeout=5, max=100
X-LiteSpeed-Cache hit
Content-Length 79
X-Powered-By PHP/5.3.5
CurrentTime Wed, 26 Jan 2011 14:26:59 GMT
Content-Type text/html; charset=UTF-8

headers reported from curl in ssh

curl -I 192.168.56.101/index.php
HTTP/1.1 200 OK
Date: Wed, 26 Jan 2011 14:01:51 GMT
Server: LiteSpeed
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
X-Powered-By: PHP/5.3.5
Content-Type: text/html; charset=ISO-8859-1
Cache-Control: private
Pragma: private
Set-Cookie: zzlastvisit=1296050511; expires=Thu, 26-Jan-2012 14:01:51 GMT; path=/
Set-Cookie: zzlastactivity=0; expires=Thu, 26-Jan-2012 14:01:51 GMT; path=/
Set-Cookie: zzimloggedin=deleted; expires=Tue, 26-Jan-2010 14:01:50 GMT; path=/



curl -I 192.168.56.101/test.php
HTTP/1.1 200 OK
Date: Wed, 26 Jan 2011 14:27:37 GMT
Server: LiteSpeed
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Transfer-Encoding: chunked
X-LiteSpeed-Cache: hit
X-Powered-By: PHP/5.3.5
CurrentTime: Wed, 26 Jan 2011 14:26:59 GMT
Content-Type: text/html; charset=UTF-8

and .htaccess used

RewriteEngine on

RewriteRule test.php - [E=Cache-Control:max-age=45]
RewriteRule hello.php - [E=Cache-Control:max-age=45]

#RewriteCond &#37;{HTTP_HOST} !^www\.domain\.com$
#RewriteRule /forum/(.*)$ http://www.domain.com/forum/$1 [R=301,L]

RewriteCond &#37;{HTTP_COOKIE} !zzimloggedin=yes
RewriteCond &#37;{HTTP_COOKIE} !zzuserid=
RewriteCond &#37;{HTTP_COOKIE} !zzpassword=
RewriteCond &#37;{REQUEST_METHOD} ^HEAD|GET$
RewriteCond &#37;{QUERY_STRING} !s=[a-fA-F0-9]{32}
RewriteCond %{QUERY_STRING} !product=vbnexus
RewriteCond %{REQUEST_URI} !^/(login|register|usercp|private|profile|cron|image) \.php$
RewriteCond %{REQUEST_URI} !^/admincp
RewriteRule /(.*\.php)?$ - [L,E=Cache-Control:max-age=120]

cache empty for index.php tests

[root@localhost html]# ls -alhR /lscache
/lscache:
total 12K
drwxrwxrwx 2 nobody nobody 4.0K Jan 25 00:09 .
drwxr-xr-x 28 root root 4.0K Jan 26 23:28 ..

headers when logged into index.php

from browser

Content-Encoding gzip
Vary Accept-Encoding
Transfer-Encoding chunked
Date Wed, 26 Jan 2011 14:09:18 GMT
Server LiteSpeed
Connection Keep-Alive
Keep-Alive timeout=5, max=100
X-Powered-By PHP/5.3.5
Content-Type text/html; charset=ISO-8859-1
Cache-Control private
Pragma private
Set-Cookie zzimloggedin=yes; path=/; HttpOnly


where do you enable rewrite logging ? the server logs have something though


2011-01-26 23:49:47.363 ERROR [[HTAccess]] rewrite: '[' is expected while parsing: RewriteCond %{REQUEST_URI} !^/(login|register|usercp|private|profile|cron|image) \.php$
2011-01-26 23:49:47.363 ERROR [[HTAccess]] rewrite: invalid rewrite condition while parsing: RewriteCond %{REQUEST_URI} !^/(login|register|usercp|private|profile|cron|image) \.php$
2011-01-26 23:57:17.880 INFO [HTAccess] Updating configuration from [/var/www/html/.htaccess]
2011-01-26 23:57:17.892 ERROR [[HTAccess]] rewrite: '[' is expected while parsing: RewriteCond %{REQUEST_URI} !^/(login|register|usercp|private|profile|cron|image) \.php$
2011-01-26 23:57:17.892 ERROR [[HTAccess]] rewrite: invalid rewrite condition while parsing: RewriteCond %{REQUEST_URI} !^/(login|register|usercp|private|profile|cron|image) \.php$

eva2000
01-26-2011, 06:35 AM
test both test.php vs testnocache.php and hello.php vs hellonocache.php and litespeed cache/rewrite works fine


ab -k -n 10000 -c 10 192.168.56.101/hello.php
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.56.101 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software: LiteSpeed
Server Hostname: 192.168.56.101
Server Port: 80

Document Path: /hello.php
Document Length: 12 bytes

Concurrency Level: 10
Time taken for tests: 0.379329 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 9907
Total transferred: 2516559 bytes
HTML transferred: 120000 bytes
Requests per second: 26362.34 [#/sec] (mean)
Time per request: 0.379 [ms] (mean)
Time per request: 0.038 [ms] (mean, across all concurrent requests)
Transfer rate: 6477.23 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 0 0 1.1 0 20
Waiting: 0 0 1.1 0 20
Total: 0 0 1.1 0 20

Percentage of the requests served within a certain time (ms)
50&#37; 0
66% 0
75% 0
80% 0
90% 0
95% 0
98% 4
99% 6
100% 20 (longest request)

[root@localhost html]# ab -k -n 10000 -c 10 192.168.56.101/hellonocache.php
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.56.101 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software: LiteSpeed
Server Hostname: 192.168.56.101
Server Port: 80

Document Path: /hellonocache.php
Document Length: 12 bytes

Concurrency Level: 10
Time taken for tests: 1.56971 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 9904
Total transferred: 2276676 bytes
HTML transferred: 120012 bytes
Requests per second: 9461.00 [#/sec] (mean)
Time per request: 1.057 [ms] (mean)
Time per request: 0.106 [ms] (mean, across all concurrent requests)
Transfer rate: 2103.18 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 0 0 2.4 0 76
Waiting: 0 0 2.4 0 76
Total: 0 0 2.4 0 76

Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 1
80% 1
90% 1
95% 2
98% 4
99% 8
100% 76 (longest request)
[root@localhost html]# ab -k -n 10000 -c 10 192.168.56.101/test.php
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.56.101 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software: LiteSpeed
Server Hostname: 192.168.56.101
Server Port: 80

Document Path: /test.php
Document Length: 63 bytes

Concurrency Level: 10
Time taken for tests: 0.372096 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 9905
Total transferred: 3466245 bytes
HTML transferred: 630000 bytes
Requests per second: 26874.79 [#/sec] (mean)
Time per request: 0.372 [ms] (mean)
Time per request: 0.037 [ms] (mean, across all concurrent requests)
Transfer rate: 9097.11 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 0 0 1.2 0 22
Waiting: 0 0 1.2 0 22
Total: 0 0 1.2 0 22

Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 0
98% 3
99% 6
100% 22 (longest request)
[root@localhost html]# ab -k -n 10000 -c 10 192.168.56.101/testnocache.php
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.56.101 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software: LiteSpeed
Server Hostname: 192.168.56.101
Server Port: 80

Document Path: /testnocache.php
Document Length: 63 bytes

Concurrency Level: 10
Time taken for tests: 1.56831 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 9905
Total transferred: 3226485 bytes
HTML transferred: 630000 bytes
Requests per second: 9462.25 [#/sec] (mean)
Time per request: 1.057 [ms] (mean)
Time per request: 0.106 [ms] (mean, across all concurrent requests)
Transfer rate: 2980.61 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 0 0 1.3 0 19
Waiting: 0 0 1.3 0 19
Total: 0 0 1.3 0 19

Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 1
80% 1
90% 1
95% 2
98% 4
99% 5
100% 19 (longest request)

NiteWave
01-26-2011, 07:07 AM
2011-01-26 23:49:47.363 ERROR [[HTAccess]] rewrite: '[' is expected while parsing: RewriteCond %{REQUEST_URI} !^/(login|register|usercp|private|profile|cron|image) \.php$

there is an extra space(before \.php$) in the rewrite rule.

eva2000
01-26-2011, 07:19 AM
thanks fixed.. but still index.php ain't caching on my vB 3.8.6 PL1 install

i commented out

#RewriteCond %{HTTP_HOST} !^www\.domain\.com$
#RewriteRule /forum/(.*)$ http://www.domain.com/forum/$1 [R=301,L]

is that okay ? accessing via 192.168.56.101 ?

NiteWave
01-26-2011, 07:24 AM
RewriteRule /(.*\.php)?$ - [L,E=Cache-Control:max-age=120]
since rewrite rule in .htaccess (not in httpd.conf), leading / should be removed. i.e.,
RewriteRule ^(.*\.php)?$ - [L,E=Cache-Control:max-age=120]

is that okay ? accessing via 192.168.56.101 ?
no problem.

eva2000
01-26-2011, 07:33 AM
changed it to below seems to be working!

RewriteEngine on

RewriteRule test.php - [E=Cache-Control:max-age=45]
RewriteRule hello.php - [E=Cache-Control:max-age=45]

#RewriteCond &#37;{HTTP_HOST} !^www\.domain\.com$
#RewriteRule /forum/(.*)$ http://www.domain.com/forum/$1 [R=301,L]


RewriteCond &#37;{HTTP_COOKIE} !zzimloggedin=yes
RewriteCond &#37;{HTTP_COOKIE} !zzuserid=
RewriteCond &#37;{HTTP_COOKIE} !zzpassword=
RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
RewriteCond %{QUERY_STRING} !s=[a-fA-F0-9]{32}
RewriteCond %{QUERY_STRING} !product=vbnexus
RewriteCond %{REQUEST_URI} !^(login|register|usercp|private|profile|cron|imag e)\.php$
RewriteCond %{REQUEST_URI} !^admincp
RewriteRule ^(.*\.php)?$ - [L,E=Cache-Control:max-age=120]

Apachebench test of vB 3.8.6 PL1 front page index.php with litespeed cache enabled resulted in a boost from 256.63 rps to 4,334 rps with litespeed cache! Showthread page boost from 183 rps to 22,695 rps. That's >16x times faster for index.php and >123x times faster for showthread page :D

Litespeed cache looking very good for guest visitor caching at least :)

vB 3.8.6 PL1 index.php page - no cache vs cached


without litespeed cache = 256.63.68 rps
with litespeed cache = 4,334.46 >16x times faster!



ab -k -n 10000 -c 10 192.168.56.101/index.php
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.56.101 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software: LiteSpeed
Server Hostname: 192.168.56.101
Server Port: 80

Document Path: /index.php
Document Length: 18978 bytes

Concurrency Level: 10
Time taken for tests: 38.966230 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 0
Total transferred: 194240000 bytes
HTML transferred: 189780000 bytes
Requests per second: 256.63 [#/sec] (mean)
Time per request: 38.966 [ms] (mean)
Time per request: 3.897 [ms] (mean, across all concurrent requests)
Transfer rate: 4867.98 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 6 38 29.1 30 231
Waiting: 5 37 29.2 30 230
Total: 6 38 29.1 30 231

Percentage of the requests served within a certain time (ms)
50% 30
66% 43
75% 53
80% 60
90% 79
95% 97
98% 118
99% 133
100% 231 (longest request)

ab -k -n 10000 -c 10 192.168.56.101/index.php
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.56.101 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software: LiteSpeed
Server Hostname: 192.168.56.101
Server Port: 80

Document Path: /index.php
Document Length: 21566 bytes

Concurrency Level: 10
Time taken for tests: 2.307090 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 0
Total transferred: 218320000 bytes
HTML transferred: 215660000 bytes
Requests per second: 4334.46 [#/sec] (mean)
Time per request: 2.307 [ms] (mean)
Time per request: 0.231 [ms] (mean, across all concurrent requests)
Transfer rate: 92412.09 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 0 1 1.5 1 10
Waiting: 0 1 1.4 1 10
Total: 0 1 1.5 1 10

Percentage of the requests served within a certain time (ms)
50% 1
66% 2
75% 2
80% 3
90% 3
95% 4
98% 5
99% 6
100% 10 (longest request)

Testing for showthread.php?t=1 page - no cache vs cached


without litespeed cache = 183.68 rps
with litespeed cache = 22,695.19 >123x times faster! :cool: :eek:


ab -k -n 10000 -c 10 192.168.56.101/showthread.php?t=1
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.56.101 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software: LiteSpeed
Server Hostname: 192.168.56.101
Server Port: 80

Document Path: /showthread.php?t=1
Document Length: 24615 bytes

Concurrency Level: 10
Time taken for tests: 54.443197 seconds
Complete requests: 10000
Failed requests: 7912
(Connect: 0, Length: 7912, Exceptions: 0)
Write errors: 0
Keep-Alive requests: 0
Total transferred: 251393444 bytes
HTML transferred: 246933288 bytes
Requests per second: 183.68 [#/sec] (mean)
Time per request: 54.443 [ms] (mean)
Time per request: 5.444 [ms] (mean, across all concurrent requests)
Transfer rate: 4509.31 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 9 53 36.3 46 335
Waiting: 8 53 36.3 46 334
Total: 9 53 36.3 46 335

Percentage of the requests served within a certain time (ms)
50% 46
66% 61
75% 72
80% 80
90% 102
95% 124
98% 150
99% 167
100% 335 (longest request)
[root@localhost html]# mv lscache.htaccess .htaccess
[root@localhost html]# ab -k -n 10000 -c 10 192.168.56.101/showthread.php?t=1
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.56.101 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


ab -k -n 10000 -c 10 192.168.56.101/showthread.php?t=1
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.56.101 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software: LiteSpeed
Server Hostname: 192.168.56.101
Server Port: 80

Document Path: /showthread.php?t=1
Document Length: 24714 bytes

Concurrency Level: 10
Time taken for tests: 0.440622 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 9906
Total transferred: 250026522 bytes
HTML transferred: 247140000 bytes
Requests per second: 22695.19 [#/sec] (mean)
Time per request: 0.441 [ms] (mean)
Time per request: 0.044 [ms] (mean, across all concurrent requests)
Transfer rate: 554139.38 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 0 0 1.4 0 28
Waiting: 0 0 1.4 0 28
Total: 0 0 1.4 0 28

Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 0
98% 4
99% 8
100% 28 (longest request)

eva2000
01-26-2011, 08:24 AM
Litespeed inbuilt cache feature test for vBulletin index.php page, up to 721x times faster than apache and 91x times faster than litespeed alone http://www.litespeedtech.com/support/forum/showthread.php?p=23183#post23183 :D

dihuta
01-28-2011, 07:24 PM
Hi Eva,

The discussion thread about VBSEO + Litespeed Guest cache here: http://www.vbseo.com/f2/help-solve-conflit-between-litespeed-guests-cache-vbseo-47657/#post300347

Could you have a look and help us?
Thank you.

eva2000
01-28-2011, 09:19 PM
not entirely sure but tried vbseo last line like this ?

RewriteRule ^(.+)$ vbseo.php [L,QSA,E=Cache-Control:max-age=120]

dihuta
01-28-2011, 10:04 PM
Still not work
Can't find X-LiteSpeed-Cache (4.0.19)

not entirely sure but tried vbseo last line like this ?

RewriteRule ^(.+)$ vbseo.php [L,QSA,E=Cache-Control:max-age=120]

eva2000
01-29-2011, 12:07 AM
Use firefox browser + firebug addon + firecookie addon, to view your site you are testing. On the cookie tab in firebug check to see you don't have any cookies set on the page you are trying to cache/test/check for cache hit header. If you have cookies set use firecookie to remove all cookies and retest.

Sometimes you'll have cookies set on the domain after you've logged into admincp/vbseo etc.

dihuta
01-29-2011, 12:46 AM
I can see it with http://www.litespeedtech.com/support/forum/, but I don't see it on mysite.

dihuta
02-03-2011, 05:21 PM
I did it.
The VBSEO staff said that VBSEO don't use htaccess to rewrite. So there is not really any page was cached. All request will go through vbseo.php.

mistwang
02-03-2011, 09:37 PM
When I visit vbseo.com, the request header is like
Host: www.vbseo.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Accept: */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://www.vbseo.com/f2/mentions-tab-profiles-47830/
Cookie: bb_languageid=1; bb_; bb_lastvisit=1296797127; bb_lastactivity=0; bb_forum_view=8073b662581c2e2a78176a8f79dfe2138d74 8bd8a-1-&#37;7Bi-2_i-1296797127_%7D; grvinsights=a431d28d7506cdd1eb9892ffbabce626; __utma=145073395.787512770.1296797132.1296797132.1 296797132.1; __utmb=145073395.10.10.1296797132; __utmc=145073395; __utmz=145073395.1296797132.1.1.utmcsr=(direct)|ut mccn=(direct)|utmcmd=(none); __utmv=145073395.usergroup-1-Unregistered%20%2F%20Not%20Logged%20In
If-Modified-Since: Fri, 21 Jan 2011 16:49:40 GMT
If-None-Match: "19aa97f-1c56-49a5e09459100"
cookie valueusergroup-1-Unregistered%20%2F%20Not%20Logged%20In
is interesting, could be used as signature for guest user if all vbseo enabled forums have this cookie.

The rewrite rule should only test request cookies indicating a guest visitor,then mark it as cacheable.

dihuta
02-03-2011, 09:42 PM
When I visit vbseo.com, the request header is like

cookie value
is interesting, could be used as signature for guest user if all vbseo enabled forums have this cookie.

The rewrite rule should only test request cookies indicating a guest visitor,then mark it as cacheable.

Could you explain in more detail?
Thanks.

NiteWave
02-03-2011, 11:41 PM
I can try rewrite rule+cache+vbseo on your site if ok at your end.

track1
02-04-2011, 04:18 AM
I'm testing this feature in a real environment (high traffic vb3 forum), and seems to work well. The level of load on the servers is similar to apache/no-cache but supports many more simultaneous requests without overloading, tested with AB.

For now, I found some problems with 503 errors (not cache related) that are already solved, and at peak times, for some unknown reason, there was an overload of the database server that had not happened before, so I had to go back to apache.

Continue testing, I have 3 active trial licenses will buy if it goes well.

NiteWave
02-05-2011, 03:27 AM
it's rather strange. the cache should reduce php/mysql load a lot.

track1
02-11-2011, 01:36 AM
I have made more intensive tests with litespeed and adding some tuning work as stable as Apache and allow more connections. Finally bought 3 enterprise licenses.

One problem with cache system/vbulletin:
- Cache system works ok, but sometimes store pages of logged-in users and displays to guest users.

My .htaccess is as follows, checking everything (cookie values, etc) is correct, i don't know how that can happen sometimes.

RewriteEngine on
RewriteCond %{HTTP_COOKIE} !bbimloggedin=yes
RewriteCond %{HTTP_COOKIE} !bbuserid=
RewriteCond %{HTTP_COOKIE} !bbpassword=
RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
RewriteCond %{QUERY_STRING} !s=[a-fA-F0-9]{32}
RewriteCond %{REQUEST_URI} !^/forum/(login|register|usercp|private|profile|cron|image) \.php$
RewriteRule (.*) - [L,E=Cache-Control:max-age=120]

NiteWave
02-11-2011, 04:39 AM
maybe this line
RewriteCond %{REQUEST_URI} !^/forum/(login|register|usercp|private|profile|cron|image) \.php$
not correct for your site?

what's the forum homepage? domain.com/ or domain.com/forum/?

p.s. what's status of the special mysql issue you mentioned last time?

track1
02-11-2011, 09:41 AM
that line and path is correct on site .htaccess (some disallowed php files to be cached rule).

Reported logged in-cached pages are sometimes for showthread.php?t=xxxxx

mysql issue was probably some puntual overload, it has not happened again. Everything is working very stable and fast.

track1
02-11-2011, 09:49 AM
this plugin have any usage with litespeed?
// Do not cache logged in user pages
if ( $vbulletin->userinfo['userid'] )
{
header('X-Accel-Expires: 0');
};

webizen
02-11-2011, 04:59 PM
Is this plugin used in every page (php request)? If not, then it can not be used as lsws needs a signature for (non)cacheable page.

bhanuprasad1981
02-12-2011, 05:14 AM
any sucess with vbseo installed site s? i have used this on two sites on my server sucessfully , but major big 3 sites use vbseo so really minimal impact i see :(

mistwang
02-14-2011, 06:51 PM
Have you tried the latest rewrite rule posted?
http://www.litespeedtech.com/support/forum/showthread.php?t=4650

mistwang
02-24-2011, 11:31 AM
this plugin have any usage with litespeed?
// Do not cache logged in user pages
if ( $vbulletin->userinfo['userid'] )
{
header('X-Accel-Expires: 0');
};

with LSWS 4.0.20, change header() code or add a new one

header('X-LiteSpeed-Cache-Control: no-cache' );
it will prevent LSWS from caching this page.

track1
02-24-2011, 12:02 PM
with LSWS 4.0.20, change header() code or add a new one

header('X-LiteSpeed-Cache-Control: no-cache' );
it will prevent LSWS from caching this page.

ok great, just upgraded to 4.0.20 and changed that header.

Haven't found why sometimes .htaccess rules were not respected, but i hope with this, any logged user page will be cached and server to not logged in users.

eva2000
03-01-2011, 05:44 AM
Thanks for thank NiteWave reminded me you'd have to enable the plugin for it to work so plugin active from 0 to 1 - see http://vbtechsupport.com/127/

so from

<plugin active="0" executionorder="1">
<title>Send X-Accel-Expires header for logged in users</title>
<hookname>style_fetch</hookname>
<phpcode><![CDATA[// Do not cache logged in user pages
if ( $vbulletin->userinfo['userid'] )
{
header('X-Accel-Expires: 0');
};]]></phpcode>
</plugin>

to
<plugin active="1" executionorder="1">
<title>Send X-Accel-Expires header for logged in users</title>
<hookname>style_fetch</hookname>
<phpcode><![CDATA[// Do not cache logged in user pages
if ( $vbulletin->userinfo['userid'] )
{
header('X-LiteSpeed-Cache-Control: no-cache' );
};]]></phpcode>
</plugin>

dihuta
03-01-2011, 05:46 PM
It's is working now with VB+VBSEO but there is an error showing sometimes when I open my website:

Your submission could not be processed because you have logged in since the previous page was loaded, please reload the windows.

This error may come from ajax.
Could you please help?
Thanks.

mistwang
03-03-2011, 08:24 PM
Maybe cached some page should not be cached.
The error is related to a security token from my google result.
what rewrite rule and code patch are you using?
Does a reload fix it?
check the response header "x-litespeed-cache: hit" see if you get a cached page, for login user, should not get any cached page.

dihuta
03-15-2011, 07:39 AM
Maybe cached some page should not be cached.
The error is related to a security token from my google result.
what rewrite rule and code patch are you using?
Does a reload fix it?
check the response header "x-litespeed-cache: hit" see if you get a cached page, for login user, should not get any cached page.


Here is the rewrite rulte:
RewriteCond &#37;{HTTP_COOKIE} !vbseo_loggedin
RewriteCond %{ORG_REQ_URI} !(login/wait|admincp|phpmyadmin|modcp|uploader|(login|regi ster|usercp|private|profile|cron|image|index_vbgal lery)\.php)
RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
RewriteCond %{QUERY_STRING} ^$
RewriteRule (.*) - [L,E=Cache-Control:max-age=300]




Reload can fix it. This issue happen when we re-visit the forum after a time.