autostarting jmeter-server with systemd

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

autostarting jmeter-server with systemd

Ivan Rancati-3
Hello,

Yesterday I installed from scratch jmeter on some virtual machines in a
cloud environment, and had an odd problem with starting jmeter-server.
As this might happen to other testers, I'm sharing the workaround that I
found


My environment
I have 10 JMeter remotes, they are virtual machines (CentOS) that are
switched off when no performance test is running,, and can be started with
OpenStack.

My problem
I wanted jmeter-server to start automatically, so I created a .service file
for bin/jmeter-service
I noticed that the Java process would start on 6 or 7 vm, not on the
remaining 3 or 4
It turns out that, with systemd, unless a dependency is explicitly given,
the order of startup is not guaranteed.
So sometimes, jmeter-server started before the network initialization was
finished, and rmi could not bind to any ip address

The workaround
Simply adding an "After" statement to the .service file (see below), to
make sure the network is fully initialized. Important in cloud
environments, where the ip address is assigned by a dhcp server.

The two other relevant settings in the file are "ExecStart" (the full path
to jmeter-server) and "WorkingDirectory" (basically, where
jmeter-server.log will be saved)

[Unit]
Description=Start Jmeter-service
After=network-online.target

[Service]
Type=simple
WorkingDirectory=/root/lasttest
ExecStart="/opt/lasttest/jmeter/bin/jmeter-server"

[Install]
WantedBy=multi-user.target


----------------

Your mileage may vary. There might be better/cleaner workarounds then mine

Thanks to the JMeter for Jmeter and happy testing,
Ivan
pmd
Reply | Threaded
Open this post in threaded view
|

Re: autostarting jmeter-server with systemd

pmd
Thanks for sharing !

On Friday, May 31, 2019, Ivan Rancati <[hidden email]> wrote:

> Hello,
>
> Yesterday I installed from scratch jmeter on some virtual machines in a
> cloud environment, and had an odd problem with starting jmeter-server.
> As this might happen to other testers, I'm sharing the workaround that I
> found
>
>
> My environment
> I have 10 JMeter remotes, they are virtual machines (CentOS) that are
> switched off when no performance test is running,, and can be started with
> OpenStack.
>
> My problem
> I wanted jmeter-server to start automatically, so I created a .service file
> for bin/jmeter-service
> I noticed that the Java process would start on 6 or 7 vm, not on the
> remaining 3 or 4
> It turns out that, with systemd, unless a dependency is explicitly given,
> the order of startup is not guaranteed.
> So sometimes, jmeter-server started before the network initialization was
> finished, and rmi could not bind to any ip address
>
> The workaround
> Simply adding an "After" statement to the .service file (see below), to
> make sure the network is fully initialized. Important in cloud
> environments, where the ip address is assigned by a dhcp server.
>
> The two other relevant settings in the file are "ExecStart" (the full path
> to jmeter-server) and "WorkingDirectory" (basically, where
> jmeter-server.log will be saved)
>
> [Unit]
> Description=Start Jmeter-service
> After=network-online.target
>
> [Service]
> Type=simple
> WorkingDirectory=/root/lasttest
> ExecStart="/opt/lasttest/jmeter/bin/jmeter-server"
>
> [Install]
> WantedBy=multi-user.target
>
>
> ----------------
>
> Your mileage may vary. There might be better/cleaner workarounds then mine
>
> Thanks to the JMeter for Jmeter and happy testing,
> Ivan
>


--
Cordialement.
Philippe Mouawad.
Reply | Threaded
Open this post in threaded view
|

Re: autostarting jmeter-server with systemd

Felix Schumacher
In reply to this post by Ivan Rancati-3

Am 31.05.19 um 12:20 schrieb Ivan Rancati:

> Hello,
>
> Yesterday I installed from scratch jmeter on some virtual machines in a
> cloud environment, and had an odd problem with starting jmeter-server.
> As this might happen to other testers, I'm sharing the workaround that I
> found
>
>
> My environment
> I have 10 JMeter remotes, they are virtual machines (CentOS) that are
> switched off when no performance test is running,, and can be started with
> OpenStack.
>
> My problem
> I wanted jmeter-server to start automatically, so I created a .service file
> for bin/jmeter-service
> I noticed that the Java process would start on 6 or 7 vm, not on the
> remaining 3 or 4
> It turns out that, with systemd, unless a dependency is explicitly given,
> the order of startup is not guaranteed.
> So sometimes, jmeter-server started before the network initialization was
> finished, and rmi could not bind to any ip address
>
> The workaround
> Simply adding an "After" statement to the .service file (see below), to
> make sure the network is fully initialized. Important in cloud
> environments, where the ip address is assigned by a dhcp server.
>
> The two other relevant settings in the file are "ExecStart" (the full path
> to jmeter-server) and "WorkingDirectory" (basically, where
> jmeter-server.log will be saved)
>
> [Unit]
> Description=Start Jmeter-service
> After=network-online.target
>
> [Service]
> Type=simple
> WorkingDirectory=/root/lasttest
> ExecStart="/opt/lasttest/jmeter/bin/jmeter-server"
>
> [Install]
> WantedBy=multi-user.target
>
>
> ----------------
>
> Your mileage may vary. There might be better/cleaner workarounds then mine

You might want to change the user running the jmeter service to some
less privileged one.

Regards,

 Felix

>
> Thanks to the JMeter for Jmeter and happy testing,
> Ivan
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]