LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > LSWS 4.1 Release > Caching function

Reply
 
Thread Tools Display Modes
  #1  
Old 02-23-2009, 08:42 PM
raphidae raphidae is offline
Senior Member
 
Join Date: Apr 2008
Posts: 59
Default Caching function

Hi,

I'm playing around with the caching function, and I was wondering if there is a way to set the maximum cache size (if reached the oldest files and/or files with the least hits are purged). Or is there a built-in limit?

The reason that I ask is that it seems that the server can just fill up the filesystem the cache directory is on. In my case I have a 512Mb ramdisk mounted for /tmp and the cache directory set to /tmp/lshttpd/cache.

Obviously I don't want /tmp to fill up, and creating a new ramdisk for lsws is not very efficient. A minimum percentage free on the filesystem setting would be perfect.

Also, I have some other questions:

1. I'd like to know what happens to the cache (files) in the event of;

-a graceful restart
-a shutdown and restart
-a crash

2. Is the original cached file checked for modifications between the moment it is cached and the moment it expires or are modifications only picked up after the cached file expires?

In any case it would be a nice feature to have the expiretime set dynamically based on hits etc. For instance to specify that a cached file expires after a day, but only if the file gets at least x hits/(timeframe<expiretime).

Thanks!
Reply With Quote
  #2  
Old 02-24-2009, 09:27 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
Right now the cache module does not monitor the disk usage, user can clear up the cache directory regular with a cron job if needed. Should give enough disk space for it. We may add the feature to clean it up.

Cache file will stay on the disk until it was removed regardless lshttpd process status.

Right now, lshttpd only checks the expiration time which is part of header of each cache file, does not store number of hits there, only track it in memory, so if lshttpd restart, the hit counter will be reset. If store the hit count in the file, it will cause too many small random write which results in bad disk I/O performance. And it is difficult to keep it in sync among multiple lshttpd processes.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:50 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.