tried to make a grinder script which reads the file and sleep when seconds
change in order to replicate the traffic rate. It nearly works ok for a low
traffic log. But it introduces several shifts when it parses high-traffic
rate log: seems like that HTTPRequest.GET() behaves only in synchronous
way, and basically it stops the script until he receives a response from
the server.
Here is the code:
-----------------------
test1 = Test(1, "Log Replay Test")
request1 = HTTPRequest()
test1.record(request1)
LOG_FILE="/home/renzo/Desktop/test/grinder-3.11/logreplay/fasce/bot-0405.log"
def getSeconds(text):
items=text.strip().split(' ')
times=items[0]
values=times.strip().split(':')
seconds=values[2]
return int(seconds)
def calculateSleepTime(before,actual):
result=actual-before
if result < 0:
result=result+60
else:
result=result
return result
class TestRunner:
def __call__(self):
stream=open(LOG_FILE,"r")
line=stream.readline()
beforeTimeStamp=getSeconds(line)
while line:
actualTimeStamp=getSeconds(line)
items=line.strip().split(' ')
url="http://"+items[1]+""+items[2]+""
var=calculateSleepTime(beforeTimeStamp,actualTimeStamp)
grinder.sleep(var*1000)
request1.GET(url)
print line
beforeTimeStamp=actualTimeStamp
line=stream.readline()
--------------------------------------------
Is there a way to use request.GET() but without stopping the worker? Thanks.
Il giorno domenica 30 giugno 2013 07:29:31 UTC+2, iain wright ha scritto:
>
> it's going to take some work, but have a look at jmeter:
> http://jmeter.apache.org/
>
> http://lincolnloop.com/blog/2012/sep/19/load-testing-jmeter-part-3-replaying-apache-logs/
> and/or grinder (we use this for very custom benchmarks, i imagine you
> could program access log replays as well, its basically anything you can
> write in python:
> http://grinder.sourceforge.net/g3/features.html
>
>
> --
> Iain Wright
> Cell: (562) 852-5916
>
> http://www.labctsi.org/
> This email message is confidential, intended only for the recipient(s)
> named above and may contain information that is privileged, exempt from
> disclosure under applicable law. If you are not the intended recipient, do
> not disclose or disseminate the message to anyone except the intended
> recipient. If you have received this message in error, or are not the named
> recipient(s), please immediately notify the sender by return email, and
> delete all copies of this message.
>
>
> On Fri, Jun 28, 2013 at 1:49 AM, Renzo Racioppi <hellf...@gmail.com<javascript:>
> > wrote:
>
>> Hi, I have both an architecture with: Apache+Fpm and Nginx+Fpm. I must
>> test them with an access log replay strategy.
>>
>> Here is the format of the log:
>>
>> 00:00:00 vhost1.com /static_file_of_5279_bytes.png
>> 00:00:00 vhost6.com /script.php?output=17359
>> 00:00:01 vhost7.com /static_file_of_595_bytes.png
>> 00:00:01 vhost8.com /static_file_of_1899_bytes.png
>> 00:00:01 vhost2.com /script.php?output=2486274
>>
>> Does anybody of you know HTTP/WebServer benchmark tools which can set
>> their proper header by reading the log, and generate the traffic whose rate
>> is based on the timestamp of the log? thanks.
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "highload-php-en" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to highload-php-...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
--
---
You received this message because you are subscribed to the Google Groups "highload-php-en" group.
To unsubscribe from this group and stop receiving emails from it, send an email to highload-php-en+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.