Configuring and testing litespeed cache Part 1

eva2000

Well-Known Member
#1
As per thread at http://www.litespeedtech.com/support/forum/showthread.php?t=4198 and at http://www.litespeedtech.com/support/forum/showthread.php?t=4401, testing out litespeed cache first with simple test.php and testnocache.php files each with the following code as per NiteWave's instructions

PHP:
<?php
header('CurrentTime: '.gmdate('D, d M Y H:i:s', time()).' GMT',true);

echo "time()=" . time() . "<br>";
echo "date()=" . date(DATE_RFC822) ."<br>";
?>
My test config has main virtual host account on 192.168.56.101 loading apache conf at /etc/httpd/conf/httpd.conf

/etc/httpd/conf/httpd.conf contains

Code:
CacheRoot /lscache/ 
CacheEnable disk /
or is it meant to be

Code:
<IfModule mod_disk_cache.c>
CacheRoot /lscache/ 
CacheEnable disk / 
</IfModule>
anyway tried both and same results

.htaccess in /var/www/html contains

Code:
RewriteRule /test.php - [E=Cache-Control:max-age=45]
with cache policy set at
Code:
Enable Cache:No
Cache Request with Query String:No
Cache Request with Cookie:No
Cache Response with Cookie:No
Ignore Request Cache-Control:No
Ignore Response Cache-Control:No
both test.php and testnocache.php don't get cached

with cache policy set to

Code:
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
both test.php and testnocache.php get cached even if i only specified test.php to be cached in htaccess ?
 
Last edited:

eva2000

Well-Known Member
#2
testnocache.php get's cached even with htaccess below

Code:
RewriteRule /test.php - [E=Cache-Control:max-age=45]
response header with cache policy as

Code:
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
Code:
Content-Encoding	gzip
Vary	Accept-Encoding
Date	Thu, 20 Jan 2011 14:05:10 GMT
Server	LiteSpeed
Connection	Keep-Alive
Keep-Alive	timeout=5, max=100
X-Powered-By	PHP/5.3.4
CurrentTime	Thu, 20 Jan 2011 14:05:10 GMT
Content-Type	text/html; charset=UTF-8
Content-Length	78
contents of cache

Code:
ls -alhR /lscache
/lscache:
total 16K
drwxrwxrwx  3 nobody nobody 4.0K Jan 21 00:05 .
drwxr-xr-x 25 root   root   4.0K Jan 20 23:06 ..
drwx------  3 nobody nobody 4.0K Jan 21 00:05 e

/lscache/e:
total 12K
drwx------ 3 nobody nobody 4.0K Jan 21 00:05 .
drwxrwxrwx 3 nobody nobody 4.0K Jan 21 00:05 ..
drwx------ 3 nobody nobody 4.0K Jan 21 00:05 9

/lscache/e/9:
total 12K
drwx------ 3 nobody nobody 4.0K Jan 21 00:05 .
drwx------ 3 nobody nobody 4.0K Jan 21 00:05 ..
drwx------ 2 nobody nobody 4.0K Jan 21 00:05 d

/lscache/e/9/d:
total 12K
drwx------ 2 nobody nobody 4.0K Jan 21 00:05 .
drwx------ 3 nobody nobody 4.0K Jan 21 00:05 ..
-rw------- 1 nobody nobody  237 Jan 21 00:05 e9d22bcd
 
Last edited:

eva2000

Well-Known Member
#3
edit: seems I have apache keepalives off and apachebench was run without keepalives, so will have to redo some tests

test.php get's cached as per htaccess

Code:
RewriteRule /test.php - [E=Cache-Control:max-age=45]
response header with cache policy as

Code:
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
response header

Code:
Content-Encoding	gzip
Vary	Accept-Encoding
Date	Thu, 20 Jan 2011 14:09:18 GMT
Server	LiteSpeed
Connection	Keep-Alive
Keep-Alive	timeout=5, max=100
X-Powered-By	PHP/5.3.4
CurrentTime	Thu, 20 Jan 2011 14:09:18 GMT
Content-Type	text/html; charset=UTF-8
Content-Length	79
Request Headers
cleared and emptied /lscache before loading test.php and this is the contents

Code:
ls -alhR /lscache
/lscache:
total 16K
drwxrwxrwx  3 nobody nobody 4.0K Jan 21 00:09 .
drwxr-xr-x 25 root   root   4.0K Jan 20 23:06 ..
drwx------  3 nobody nobody 4.0K Jan 21 00:09 9

/lscache/9:
total 12K
drwx------ 3 nobody nobody 4.0K Jan 21 00:09 .
drwxrwxrwx 3 nobody nobody 4.0K Jan 21 00:09 ..
drwx------ 3 nobody nobody 4.0K Jan 21 00:09 f

/lscache/9/f:
total 12K
drwx------ 3 nobody nobody 4.0K Jan 21 00:09 .
drwx------ 3 nobody nobody 4.0K Jan 21 00:09 ..
drwx------ 2 nobody nobody 4.0K Jan 21 00:09 2

/lscache/9/f/2:
total 12K
drwx------ 2 nobody nobody 4.0K Jan 21 00:09 .
drwx------ 3 nobody nobody 4.0K Jan 21 00:09 ..
-rw------- 1 nobody nobody  231 Jan 21 00:09 9f283728
Both test.php and testnocache.php get cached according to apachebench

for test.php

Code:
ab -n 1000 -c 200 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 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


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

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

Concurrency Level:      200
Time taken for tests:   0.62169 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      288288 bytes
HTML transferred:       63504 bytes
Requests per second:    16085.19 [#/sec] (mean)
Time per request:       12.434 [ms] (mean)
Time per request:       0.062 [ms] (mean, across all concurrent requests)
Transfer rate:          4519.94 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2   1.6      2       7
Processing:     2    8   3.4      9      54
Waiting:        0    3   2.6      4      49
Total:          3   10   3.7     11      54

Percentage of the requests served within a certain time (ms)
  50%     11
  66%     12
  75%     13
  80%     13
  90%     14
  95%     15
  98%     16
  99%     17
 100%     54 (longest request)
for testnocache.php

Code:
ab -n 1000 -c 200 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 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


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

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

Concurrency Level:      200
Time taken for tests:   0.73192 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      273182 bytes
HTML transferred:       64701 bytes
Requests per second:    13662.70 [#/sec] (mean)
Time per request:       14.638 [ms] (mean)
Time per request:       0.073 [ms] (mean, across all concurrent requests)
Transfer rate:          3634.28 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    3   5.4      1      22
Processing:     2    9   3.9      8      19
Waiting:        0    4   3.7      4      18
Total:          2   13   7.6     10      34

Percentage of the requests served within a certain time (ms)
  50%     10
  66%     12
  75%     18
  80%     20
  90%     26
  95%     30
  98%     32
  99%     33
 100%     34 (longest request)
Without caching requests per second was around 3980 - 4100 per second. So litespeed cache nearly 4x times boost, but it's ignoring my htaccess to cache only test.php ?

without cache

Code:
ab -n 1000 -c 200 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 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


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

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

Concurrency Level:      200
Time taken for tests:   0.239160 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      342056 bytes
HTML transferred:       75348 bytes
Requests per second:    4181.30 [#/sec] (mean)
Time per request:       47.832 [ms] (mean)
Time per request:       0.239 [ms] (mean, across all concurrent requests)
Transfer rate:          1396.55 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   17  11.1     18      39
Processing:    11   21   6.2     21      92
Waiting:        0   14   8.8     15      52
Total:         27   39   6.4     39     114

Percentage of the requests served within a certain time (ms)
  50%     39
  66%     42
  75%     44
  80%     45
  90%     47
  95%     48
  98%     50
  99%     50
 100%    114 (longest request)

Code:
ab -n 1000 -c 200 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 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


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

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

Concurrency Level:      200
Time taken for tests:   0.254171 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      341198 bytes
HTML transferred:       75159 bytes
Requests per second:    3934.36 [#/sec] (mean)
Time per request:       50.834 [ms] (mean)
Time per request:       0.254 [ms] (mean, across all concurrent requests)
Transfer rate:          1310.14 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   18  11.9     18      47
Processing:    11   23   7.6     23     106
Waiting:        0   16  10.0     16     103
Total:         28   41   8.0     41     118

Percentage of the requests served within a certain time (ms)
  50%     41
  66%     44
  75%     47
  80%     48
  90%     51
  95%     55
  98%     58
  99%     60
 100%    118 (longest request)
edit: seems I have apache keepalives off and apachebench was run without keepalives, so will have to redo some tests
 
Last edited:

NiteWave

Administrator
#5
Thanks for the testing.

glad to hear this test result:
Without caching requests per second was around 3980 - 4100 per second. So litespeed cache nearly 4x times boost
We just updated 4.0.19, when a page is from cache, the response header will have "X-LiteSpeed-Cache: hit". so it's easier for us to test cache function.

I'll try to reproduce your testing on our cPanel server.
 

eva2000

Well-Known Member
#6
Sweet new response header will make things much easier. Is there a cache debug log feature ? Enable cache debug log and it will log and track the creation time/filename/path to the cached file in cache directory ?

So litespeed cache is more of a disk cache right ? Possible to have a memory cache version too ?
 
Last edited:

NiteWave

Administrator
#7
I tested set cache directory on admin console, rewrite rule works well.
Server->Cache->Storage Path:/lscache

it should be same as
CacheRoot /lscache/
in httpd.conf

why testnocache.php is cached? I think because of this directive:
CacheEnable disk /
it should be same as
Server->Cache->Enable Cache:Yes

so please remove
CacheEnable disk /
and test again.

regarding memory cache, maybe after diskcache is stable enough :)
 

eva2000

Well-Known Member
#8
k thats, will test again without CacheEnable disk / :)

edit: just tested and with CacheEnable disk / removed, litespeed doesn't cache anything at all, test.php averages 4600 rps.

with .htaccess

Code:
RewriteRule /test.php - [E=Cache-Control:max-age=45]
with this policy
Code:
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
BUT if i re-add CacheEnable disk /, then test.php is cached but so is testnocache.php

wow not sure what changed but 20k rps with litespeed + cache enabled

Code:
ab -n 1000 -c 200 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 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


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

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

Concurrency Level:      200
Time taken for tests:   0.49758 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      272384 bytes
HTML transferred:       64512 bytes
[B]Requests per second:    20097.27[/B] [#/sec] (mean)
Time per request:       9.952 [ms] (mean)
Time per request:       0.050 [ms] (mean, across all concurrent requests)
Transfer rate:          5345.87 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   1.6      1       6
Processing:     2    7   2.9      7      23
Waiting:        0    4   2.6      4      19
Total:          2    8   3.2      8      26

Percentage of the requests served within a certain time (ms)
  50%      8
  66%      9
  75%     10
  80%     11
  90%     13
  95%     14
  98%     16
  99%     19
 100%     26 (longest request)
Code:
ab -n 1000 -c 200 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 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


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

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

Concurrency Level:      200
Time taken for tests:   0.51467 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      271586 bytes
HTML transferred:       64323 bytes
Requests per second:    19429.93 [#/sec] (mean)
Time per request:       10.293 [ms] (mean)
Time per request:       0.051 [ms] (mean, across all concurrent requests)
Transfer rate:          5148.93 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   1.4      1       6
Processing:     2    7   3.0      8      27
Waiting:        0    4   2.5      4      22
Total:          2    9   3.0      9      28

Percentage of the requests served within a certain time (ms)
  50%      9
  66%     10
  75%     11
  80%     11
  90%     12
  95%     14
  98%     16
  99%     17
 100%     28 (longest request)
 
Last edited:

eva2000

Well-Known Member
#9
I also tested a few different configs on test.php

edit: seems I have apache keepalives off and apachebench was run without keepalives, so will have to redo some tests

  1. apache standalone
  2. apache + varnish 2.1.4 defaults on port 8888
  3. litespeed no cache + varnish 2.1.4 defaults on port 8888

just post summary here

system is
System is virtualbox virtual guest CentOS 5.5 64bit install with Xeon W3540 @3408Mhz, 640GB Samsung SATAII drive OS disk with 1GB out of 6GB DDR3-1550Mhz 9-9-9-24 memory speed assigned to guest OS.
Code:
ab -n 1000 -c 200 192.168.56.101/test.php
apache standalone
Code:
1st run - Requests per second:    4496.60
2nd run - Requests per second:    1309.79
3rd run - Requests per second:    408.32
4th run - Requests per second:    120.17
apache + varnish 2.1.4 defaults on port 8888
Code:
1st run - Requests per second:    4240.09 (uncached)
2nd run - Requests per second:    9565.99
3rd run - Requests per second:    8947.67
4th run - Requests per second:    8688.70
5th run - Requests per second:    8600.38
average = 8,008 rps (including uncached 1st response) or 8,950 rps varnish cached
litespeed no cache + varnish 2.1.4 defaults on port 8888
Code:
1st run - Requests per second:    10661.32
2nd run - Requests per second:    9079.93
3rd run - Requests per second:    8776.55
4th run - Requests per second:    8805.22
5th run - Requests per second:    9213.36
average = 9,307 rps
Looks like Litespeed cache still leading for small test.php file at least at 13-20K rps - nearly 2-5x times faster than litespeed no cache, or up to 2x times faster than apache + varnish defaults or litespeed + varnish defaults
 
Last edited:
#10
Looks like Litespeed cache still leading for small test.php file at least at 13-20K rps - nearly 5x times faster than litespeed no cache, or up to 2x times faster than apache or litespeed with varnish defaults
great!

just tested and with CacheEnable disk / removed, litespeed doesn't cache anything at all, test.php averages 4600 rps.
maybe lack of
RewriteEngine on ?

please try these in .htaccess
Code:
RewriteEngine on
RewriteRule test.php - [E=Cache-Control:max-age=45]
note: use test.php instead of /test.php
 

eva2000

Well-Known Member
#11
Just tried adding

Code:
RewriteEngine on
RewriteRule test.php - [E=Cache-Control:max-age=45]
still doesn't cache anything if CacheEnable disk / is removed

AND

caches both test.php and testnocache.php when CacheEnable disk / is added back in
 
Last edited:

mistwang

LiteSpeed Staff
#12
Please upgrade to 4.0.19 if have not yet, and try again.
If still not working, need to enable debug logging and rewritelog to figure out what is wrong.
I wonder if .htaccess is working properly or not.
 

eva2000

Well-Known Member
#13
still on 4.0.18, but found a configuration which works to cache only test.php but not testnocache.php

htaccess

Code:
RewriteEngine on
RewriteRule test.php - [E=Cache-Control:max-age=45]
cache policy set to

Code:
Enable Cache:Not set
Cache Expire Time (seconds): 120
Cache Request with Query String:Not set
Cache Request with Cookie:Not set
Cache Response with Cookie:Not set
Ignore Request Cache-Control:Not set
Ignore Response Cache-Control:Not set
httpd.conf set to

Code:
#disk cache
<IfModule mod_cache.c>
<IfModule mod_disk_cache.c>
CacheRoot /lscache/   
#CacheEnable disk /  
</IfModule>
</IfModule>
testnocache.php

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

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

Concurrency Level:      200
Time taken for tests:   0.201163 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      286000 bytes
HTML transferred:       63000 bytes
Requests per second:    4971.09 [#/sec] (mean)
Time per request:       40.233 [ms] (mean)
Time per request:       0.201 [ms] (mean, across all concurrent requests)
Transfer rate:          1386.94 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   17  11.3     17      40
Processing:     5   21   7.1     21      66
Waiting:        0   14   9.0     15      59
Total:          5   38   8.6     38      80

Percentage of the requests served within a certain time (ms)
  50%     38
  66%     42
  75%     44
  80%     45
  90%     47
  95%     49
  98%     51
  99%     74
 100%     80 (longest request)
Code:
ls -alhR
.:
total 12K
drwxrwxrwx  2 nobody nobody 4.0K Jan 21 10:10 .
drwxr-xr-x 25 root   root   4.0K Jan 21 10:03 ..
test.php properly cached

Code:
ab -n 1000 -c 200 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 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


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

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

Concurrency Level:      200
Time taken for tests:   0.61408 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      287144 bytes
HTML transferred:       63252 bytes
Requests per second:    16284.52 [#/sec] (mean)
Time per request:       12.282 [ms] (mean)
Time per request:       0.061 [ms] (mean, across all concurrent requests)
Transfer rate:          4559.67 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2   2.2      2       9
Processing:     3    8   2.5      9      16
Waiting:        1    3   1.5      3       9
Total:          3   10   3.1     11      22

Percentage of the requests served within a certain time (ms)
  50%     11
  66%     12
  75%     13
  80%     13
  90%     14
  95%     15
  98%     17
  99%     18
 100%     22 (longest request)
Code:
ls -alhR
.:
total 16K
drwxrwxrwx  3 nobody nobody 4.0K Jan 21 10:16 .
drwxr-xr-x 25 root   root   4.0K Jan 21 10:03 ..
drwx------  3 nobody nobody 4.0K Jan 21 10:16 9

./9:
total 12K
drwx------ 3 nobody nobody 4.0K Jan 21 10:16 .
drwxrwxrwx 3 nobody nobody 4.0K Jan 21 10:16 ..
drwx------ 3 nobody nobody 4.0K Jan 21 10:16 f

./9/f:
total 12K
drwx------ 3 nobody nobody 4.0K Jan 21 10:16 .
drwx------ 3 nobody nobody 4.0K Jan 21 10:16 ..
drwx------ 2 nobody nobody 4.0K Jan 21 10:16 2

./9/f/2:
total 12K
drwx------ 2 nobody nobody 4.0K Jan 21 10:16 .
drwx------ 3 nobody nobody 4.0K Jan 21 10:16 ..
-rw------- 1 nobody nobody  215 Jan 21 10:16 9f283728
 
#14
per your testing on 4.0.18, it looks like set
CacheRoot /lscache/
in httpd.conf is not same as setting CacheRoot at admin console.
and as I tested, without "CacheRoot /lscache/" in httpd.conf, but set it in admin console, rewriterule + cache will work. so it looks that
"CacheRoot /lscache/" in httpd.conf +
set "Cache Expire Time" in admin console can enable "rewriterule + cache"

this should not be designed behavior and complicated to users. please try 4.0.19 to see if this has been fixed.
 

eva2000

Well-Known Member
#15
K thanks will try 4.0.19 later, need to get some sleep

Interesting notes

1. tuning varnish from default gives an extra ~500 rps.
2. raising apachebench concurrency from 200 to 400, litespeed cache still pushes out consistent 16k rps vs varnish which drops to under 9k rps. But pushing concurrency from 200 to 600, has the situation reversed with litespeed cache dropping from 1st, 2nd and 3rd run = 16k, 11k, down to just 330 rps on 3rd run (disk i/o ?) vs varnish dropping to consistent 7.5k rps.

will update to 4.0.19 later tonight :)
 
Last edited:

mistwang

LiteSpeed Staff
#16
2. raising apachebench concurrency from 200 to 400, litespeed cache still pushes out consistent 16k rps vs varnish which drops to under 9k rps. But pushing concurrency from 200 to 600, has the situation reversed with litespeed cache dropping from 1st, 2nd and 3rd run = 16k, 11k, down to just 330 rps on 3rd run (disk i/o ?) vs varnish dropping to consistent 7.5k rps.
Likely a problem with kernel socket limits, there should not be big differences when you run the benchmark test multiple times.

Try adding "-k" option to "ab".
 

eva2000

Well-Known Member
#18
Good news Litespeed 4.0.19 fixed the cache settings issue, now test.php gets cached while testnocache.php doesn't get cached with cache policy in 4.0.19 set as per below settings.

test.php header

Code:
view source
Content-Encoding	gzip
Vary	Accept-Encoding
Date	Fri, 21 Jan 2011 20:54:52 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	Fri, 21 Jan 2011 20:54:34 GMT
Content-Type	text/html; charset=UTF-8
testnocache.php header

Code:
Content-Encoding	gzip
Vary	Accept-Encoding
Date	Fri, 21 Jan 2011 20:54:59 GMT
Server	LiteSpeed
Connection	Keep-Alive
Keep-Alive	timeout=5, max=100
X-Powered-By	PHP/5.3.5
CurrentTime	Fri, 21 Jan 2011 20:54:59 GMT
Content-Type	text/html; charset=UTF-8
Content-Length	79
test.php

Code:
 ab -k -n 1000 -c 200 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 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


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

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

Concurrency Level:      200
Time taken for tests:   0.42640 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    1000
Total transferred:      346952 bytes
HTML transferred:       63000 bytes
Requests per second:    23452.16 [#/sec] (mean)
Time per request:       8.528 [ms] (mean)
Time per request:       0.043 [ms] (mean, across all concurrent requests)
Transfer rate:          7926.83 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   1.6      0       6
Processing:     0    2   1.0      3       5
Waiting:        0    2   1.0      3       5
Total:          0    3   1.5      3      11

Percentage of the requests served within a certain time (ms)
  50%      3
  66%      3
  75%      3
  80%      3
  90%      6
  95%      7
  98%      8
  99%      8
 100%     11 (longest request)
testnocache.php

Code:
ab -k -n 1000 -c 200 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 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


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

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

Concurrency Level:      200
Time taken for tests:   0.184258 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    1000
Total transferred:      323000 bytes
HTML transferred:       63000 bytes
Requests per second:    5427.17 [#/sec] (mean)
Time per request:       36.852 [ms] (mean)
Time per request:       0.184 [ms] (mean, across all concurrent requests)
Transfer rate:          1709.56 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   1.5      0       6
Processing:    20   28  14.6     21      89
Waiting:       20   28  14.4     21      88
Total:         20   29  15.7     21      89

Percentage of the requests served within a certain time (ms)
  50%     21
  66%     26
  75%     27
  80%     28
  90%     59
  95%     67
  98%     72
  99%     83
 100%     89 (longest request)
The test.php and testnocache.php file used contains

Code:
<?php
header('CurrentTime: '.gmdate('D, d M Y H:i:s', time()).' GMT',true);

echo "time()=" . time() . "<br>";
echo "date()=" . date(DATE_RFC822) ."<br>";
?>
Apache httpd.conf contains

Code:
#disk cache
<IfModule mod_cache.c>
<IfModule mod_disk_cache.c>
CacheRoot /lscache/   
#CacheEnable disk /  
</IfModule>
</IfModule>
Litespeed 4.0.18 cache policy is set to

Code:
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
.htaccess used

Code:
RewriteEngine on
RewriteRule test.php - [E=Cache-Control:max-age=45]
 
Last edited:
Top