How to benchmark apache with delays? - apache

What is a good way to benchmark apache with a delay between requests from a unix command line? The only benchmark tool I know from the command line is ab and it doesn't support delays.

You could run ab through watch to delay the repeated access, but you're not going to be able to use the report summary for much.
watch -n 1 ab -n 3 http://serverfault.com/
Or run it through curl instead of ab
watch -n 0.4 curl http://serverfault.com/
More about watch:
http://www.linfo.org/watch.html

I just love The Grinder, a fully programmable testing tool. Sadly you can't run it completely from the command line, but I'd really give it a try if I were you.
Failing that, you have httperf which is indeed command line and supports "user sessions" (that is, delays) and many other options.

Commercial tools like HP loadrunner and Borland Silk have this feature. We call this delay between request as THINK TIME for n simulated users.

Related

Redirecting output of bluez btmgmt to file from systemd service

I try to have separate ssp modes during connection using Bluetooth btmgmt utility. Basic idea is scan current device OUI and select ssp on/off modes. But I can't get any answer from neither btmgmt con or btmgmt info commands when I put them into .service files. My system is Arch Linux arm 32-bit and bluez stack version is 5.55-1. I tried
[Unit]
Description=check Bluetooth address
[Service]
Type=oneshot
ExecStart=/usr/bin/bash -c '/usr/bin/btmgmt info >> /usr/local/lib/mac 2>&1'
without any success: it just puts nothing in output file. Some tricks like add
User=root
Group=root
or substitute ExecStart with
ExecStart=/bin/bash -c 'echo -e "$(btmgmt con)" >> /usr/local/lib/mac 2>&1
did nothing. I tried changed thing by putting btmgmt stuff in different bash script instead of start them right from service file, i.e.
ExecStart=/usr/local/lib/test1
to no avail. I'm confused completely, because of:
It doesn't seem to be general btmgmt thing problem, because I can set ssp mode from service files
in very simple manner, just using
ExecStart=btmgmt off
or
ExecStart=btmgmt off
even without full path.
It doesn't seem to be redirecting command error as well, because if I add
ExecStartPre=/usr/bin/bash -c '/usr/bin/fdisk -l > /usr/local/lib/mac 2>&1'
it does work without any problem and I see fdisk info in file (I use fdisk because it requires elevated rights same as btmgmt one).
Moreover, btmgmt info works in the same way, i.e. shows nothing in out file. It makes me think something is wrong in output of btmgmt. I talk about output because input parameters work fine in btmgmt ssp on/of commands and journalctl and systemct don't show any errors in btmgmt con/info cases, so it seems to like output generating successfully but then sending somewhere to outer space, but I'm not sure completely.
Thanks for any help in advance
Well, I make a statement: btmgmt is quite intended to be used for output at any manner, but they tried make a zillion variants of output which directed to exact result it should be: bug is buried somewhere deep inside of bt_shell_printf and struct data. I'm not ready run through all that disgusting documented code (I mean total absence of comments or more-or-less satisfactory mans), so I ended up with a liitte bit hacked version of utility downgraded to simple fprintf in output, leaving only commands I need: con, ssp, power and simplified until only current setting printing info. Everything works fine, and I can use that kind of btmgmt not with systemd only, but even with udev rules (indirectly, of course)
I know this is an old question, but I had the same problem, and managed to fix it after hours and hours of trying.
I don't know why in the world this happens to be so hard with btmgmt but here's the fix:
[Unit]
After=bluetooth.service
Description=Bluetooth service
[Service]
ExecStart=<your-process>
Group=root
StandardInput=tty
TTYPath=/dev/tty2
TTYReset=yes
TTYVHangup=yes
Type=simple
User=root
Basically, by occupying a TTY, btmgmt will think it's running in an interactive terminal, and will output as usual.
Hope this saves anyone the hell I've been through!

SSH command step not working for one command - in Jmeter

I have a unique problem using jmeter SSH command.
I use this step to run spark jobs.
the problem is that one of the commands not working, to clarify it connects and not get response and just wait and wait for hours, and nothing displayed on screen.
I know how to work with the tool, and this behavior is special for this script alone.
All other script worked, I duplicate one that worked for example
sudo /run_stg.sh this command worked
sudo /run_off2-stg.sh this command not worked
if I run the job manually via jenkins it worked
if I entered to command line and use plik ssh it worked,
the problem is just Jmeter, that is waiting and waiting and I can not understand for what?
the job is about 3 minutes, and I wait for response in Jmeter for 4 hours and nothing Jmeter just waiting.
in the console log I set to trace level and nothing, absolutely no idea how to start handle this issue in Jmeter.
an anyone please assists how to make Jmeter to write what happened?
or just to know if he connect or anything
since this behavior all the test can not be performed
Most probably you are as usual misconfiguring the SSH Command sampler.
The idea is not to run the script per se, you need to delegate the script execution to the Unix Shell, for example Bash this way you will be able to combine several commands together, see the output, amend debugging level, etc.
So I would recommend setting your command to something like /bin/bash -c -x /your/script.sh
Another guess, given you use sudo it might be the case that the sudo command simply waits for the password (which JMeter never provides), if this is the case try amending your script permissions using chmod command and allowing your user its execution without root privileges.
And finally, given you're able to run your command using "plik ssh" (whatever it is) you can run it using OS Process Sampler
More information: How to Run External Commands and Programs Locally and Remotely from JMeter

Get current CPU usage in monkeyrunner script

I am using a monkeyrunner Jython script to automate some UI test. I want to confirm that the previous step is complete before doing the next step, based on the current CPU usage of the OS (of the PC the emulator is running on). Hence I need a way to get current CPU usage in a monkeyrunner Jython script.
I've done some survey, but looks like monkeyrunner Jython script does not work with psutil: Monkeyrunner doesnt find my module
Anyone could tell me what is the easiest way to get current CPU usage in a monkeyrunner Jython script?
Thanks.
You can invoke shell commands directly from MonkeyDevice:
top10 = device.shell('top -n 1 -m 10')
try top command to get cpu usage,
1.try this if you want to get cpu usage of android device:-
import os
top_10_ps_list=os.popen('adb shell top -n 1 -m 10').read()
2.try this if you want to get cpu usage of PC OS:-
import os
top_10_ps_list=os.popen('top -b -n 1').read()

Using bitbake to build a custom gumstix kernel

I've a gumstix Overo which I am configuring to work with a e-CAM camera. The documentation provided by camera manufacture asks me to patch a 2.6.34 kernel and compile in Video For Linux support. When I look at gumstix user documentation they say I should execute:
bitbake -c menuconfig virtual/linux
However when I run this command I get
bacon:~/proj/overo-oe$ bitbake -c menuconfig virtual/linux
NOTE: Handling BitBake files: \ (7100/7100) [100 %]
NOTE: Parsing finished. 6382 cached, 413 parsed, 305 skipped, 2 masked.
ERROR: Nothing PROVIDES 'virtual/linux'
I'm not altogether sure about how I provide virtual/linux. Any ideas about how to fix this error?
This might be a case of out-of-date documentation. In any case, my current work around is to name the kernel explicitly: bitbake -c menuconfig linux-omap3-2.6.34
I can help with a step-by-step procedure to bitbake 3.0 kernel.
If that may be helpful for you. Using a WMware Ubuntu ...
I would stay away from convoluted build systems as bitbake. Every one seems to be inventing one... making the 'tool' to get more of your time then the thing you want to do with the tool. All of them are the same. Linus would quote on those guys:
Just don't do it...!

apachebench aborts with a strange error message

I run a very simple php file on apache. Then I benchmark apache, using
ab -n 10000 -c 5 http://localhost/~me/hello.php?name=Niko
But I get this error message, depending on c (for c=1, things are fine):
apr_socket_connect(): Operation already in progress (37)
I'm using ApacheBench, Version 2.3 on OSX 10.5.7.
The very simple PHP file would be this one:
<h1>Hello <?=$_REQUEST['name']?></h1>
This might be connected with http://www.nabble.com/ab(1)-fix-(Operation-already-in-progress-(37))-td22821642.html.
This might be it. The post says:
fixed in trunk
Changes were significant, so I have no
plans to propose for backport to the
2.2.x branch in the short term. With some testing/everyday use in trunk on
various platforms, it may be
appropriate to backport later.
Well. That means I would have to wait for 2.3 or work straight with the trunk. I'm just doing hobby stuff, so: no thanks.