URL randomization patch for cache testing
Status: Alpha
Brought to you by:
coroberti
From: Pranav D. <pra...@gm...> - 2010-09-21 00:53:00
|
Hello, I wanted to test a caching server using curl-loader. curl-loader uses a fixed set of URLs, so a cache would perform quite well (serving many things from RAM) unless you have a really large set of URLs as in the real world. So to stress test the cache with a small URL set, I created a small patch to add a random string in the URL. The web-server on the other side of the cache also needs to be able to translate the random string back to the original URL. This way you can pretty much use a single URL to test the cache and at the same time you dont have to store lots of objects on the webserver. I have attached the patch in case someone wants to use it. I can write up some doc if its worth adding to the main code base. curl-loader config ------------------- URL=http://172.16.55.210/JUNKSTR/websites/testube/video/cNvJy0zoXOY.34 URL_RANDOM_RANGE=0-2000 URL_RANDOM_TOKEN=JUNKSTR TIMER_AFTER_URL_SLEEP=3000 This will replace the token "JUNKSTR" in the URL with a random number between 0-2k. So the access logs should look like: 1285029140.940 5999 13.4.0.28 TCP_MISS/200 14827899 GET http://172.16.55.210/276/websites/testube/video/cNvJy0zoXOY.34 - DIRECT/172.16.55.21 0 application/octet-stream - 1285029141.408 6164 13.4.0.23 TCP_MISS/200 14827899 GET http://172.16.55.210/1158/websites/testube/video/cNvJy0zoXOY.34 - DIRECT/172.16.55.2 10 application/octet-stream - lighttpd webserver config ----------------------------- To translate the URLs back to a single URL I used rewrite rules, e.g. url.rewrite = ( "^/[^/]*(.*)$" => "$1" ) you can choose to use some different method. Hope this helps. -- Pranav |