Hello everyone,
In Part 1 (http://ktaraghi.blogspot.ca/2015/02/installing-open-virtual-desktop-ovd-on.html ), I showed you how to install OVD and add Linux and Windows server to Session Manager and also how to install the Web Portal.
Now, I am going to show you how to configure and launch and publish Windows and Linux
applications. First, we need to create some users.
Click on User tab in Admin console. You have different options here. You can either type them manually and add them to internal database (Figure 1) or ask system to create and populate some random username for you (Figure 2). Also, you can import users from directory service located at Configuration ->Domain integration setting (Figure3, 4):
Figure 1
Figure 2
Figure 3
Figure 4
Then, you need a user group. On the same User tab, click on User Groups and create a
group. Here I named them All Employee.
Figure 5
Figure 6
You have a couple of options here that you can assign to groups if you want to, such as
session setting, time restrictions, remote desktop setting and etc…
Figure 7
Now, you need to create a group for applications. Go to Application ->Application Groups. I
create 2 groups for myself. One for Linux apps and one for Windows app.
Figure 8
Then, add desired applications to both application groups:
Figure 9
The same process for Windows group:
Figure 10
Figure 11
And finally, to release applications to users, Go to Application tab and then click on
Publications. Then map the desired groups to desired application groups:
Figure 12
Now, Go to web portal, in this case http://web.ovd.com/ovd/
I am going to show you both Desktop and Portal mode. In Desktop mode, enter your
credentials and click on Connect:
Figure 13
As soon as you connect, which is really fast (thanks to HTML5), you will see your desktop and
all your mixed Linux and Windows applications:
Figure 14
Figure 15
In Portal mode, which is a really good mode for smart phones and tablets, you will see all
application icons arranged like tiles beside each others:
Figure 16
Other configurations in Admin console are pretty much self explanatory. The last thing that is
good to know is that you are able to see not only active sessions but also to see a history of
all sessions:
Figure 17
Figure 18
And that’s all. Hope you enjoyed.
Khosro Taraghi
Info and Cited work (for both part1 and part 2 of this article):
Ulteo Open Virtual Desktop v4.0.2 Red Hat Enterprise Linux (RHEL) 6.0 support. 2014. 03
March 2015 < http://archive.ulteo.com/ovd/4.0/docs/Support_RHEL_6.0.html > .
Monday, March 2, 2015
Saturday, February 28, 2015
Installing Open Virtual Desktop (OVD) on RedHat/CentOS/Fedora (Part 1)
Hello everyone,
Today, I am very excited to talk about Open Virtual Desktop (OVD). If you are looking for
merging Linux and Windows applications and access them all over Internet/network via your
browser, desktop, tablets, or your smart phone with the same speed as running those
applications on the actual server, OVD is that what you need.
OVD has two editions. One is Community Edition (free edition) that we are going to talk about
that today and the other one is Enterprise Edition. Both have the same functionality except
that Enterprise edition has support, updates, patches, native client and the SSL gateway for
access via the Internet.
To install and configure the OVD, we need at least 3 or 4 servers in production environments
(a Session Manager, an Application Server or Subsystem, a Windows Server
(2003/2008/2012 only) for Windows applications, a Web Portal and a
SSL/Gateway(enterprise only) for production environment), however, for demonstrating
purposes and lack of resources, I am going to install all of them in one server except Windows
server. So, total 2 servers for my purpose.
The server that I am working on is CentOS 6.6 but the process of installation should be the
same as all RedHat families. Let’s install OVD:
The first thing you need to do is disabling SELinux because Ulteo OVD is not compatible with
SELinux yet, which I don’t like to disable SELinux personally but no choice for now:
sestatus
vi /etc/selinux/config and set SELINUX=disabled
reboot
Figure 1
Then, you need to add Ulteo rpm repository into your server. Create a file called ovd.repo in
/etc/yum.repos.d/ and add following lines in the file:
vi /etc/yum.repos.d/ovd.repo
[ovd4.0.2]
name=Ulteo OVD 4.0.2
baseurl=http://archive.ulteo.com/ovd/4.0/rhel/6.0/
enabled=1
gpgcheck=1
gpgkey=http://archive.ulteo.com/ovd/4.0/rhel/6.0/keyring
Figure 2
database. To install MySQL and create a database for Session Manager, follow the
instructions below:
yum install mysql mysqlserver → install MySQL package
chkconfig mysqld on → To start automatically MySQL when the system boots up
service mysqld start → Start the service
mysqladmin -u root password 'your_password_here' → Define the root mysql password
mysql -u root -p -e 'create database ovd' → Create a database for ovd Session Manager
Now, install Session Manager and Administration Console:
yum install ulteo-ovd-session-manager ulteo-ovd-administration-console
Launch the configuration tool (needs access to Internet):
sm-config
Figure 3
Launch the Administration Console configuration tool (press Enter to accept the default local
host address if the Session Manager is in the same machine or enter the ip address of
Session Manager):
ovd-administration-console-config
Figure 4
Restart Apache service:
chkconfig httpd on → To start automatically Apache when the system boots up
service httpd restart
Since I don’t have DNS server here, I am going to use host entry in /etc/hosts file. We need 3
FQDN records (Session Manager, Application Server, Web Portal):
vi /etc/hosts → add following lines below:
127.0.0.1 sm.ovd.com
127.0.0.1 app.ovd.com
127.0.0.1 web.ovd.com
Now, we need to configure our Session Manager. Go to this url:
http://sm.ovd.com/ovd/admin
and login to admin page:
Figure 5
Since this is the first time that you login to admin, it will redirect you to setup page for
database. Enter your root credentials for database and click Save:
Figure 6
Now, you need to adjust the timezone in PHP setting, do the followings:
vi /etc/php.ini
date.timezone = America/Toronto → Change the timezone accordingly; you can find a list
of timezones here: http://php.net/manual/en/timezones.php
then, restart apache:
service httpd restart
Figure 7
subsystem package:
yum install ulteo-ovd-subsystem
Due to a conflict, you may have to uninstall samba packages before installing the
ulteo-ovd-session-manager package. Remove the samba client and server packages:
yum remove samba*
then launch the configuration tool:
ovd-subsystem-config
Figure 8
Configure and start the Ulteo service:
chkconfig ulteo-ovd-subsystem on
service ulteo-ovd-subsystem restart
Now that you have installed and configured your Application or Subsystem, go back to admin
page and click on Unregistered servers under Servers and you will see your Application
server is there. Just click on Register to register your Application server.
Figure 9
After clicking on Register button, if you have followed my instructions, you may see the
following message:
Server "localhost": redirection name may be invalid!
Figure 10
To fix that, click on localhost and enter the following info:
Display name: Linux Apps → Whatever name you like and then click on Define
Internal name (fqdn): localhost → use localhost and then click on Change
Redirection name for this server: app.ovd.com → I used fqdn that I defined in /etc/hosts and
then click Change
I disabled fs role since I don’t want to use it.
Then click on Switch to production button.
Note:
The redirection name is used when launching sessions. When you launch a session, you are
redirected to an Application Server using the redirection name as target host.
Figure 11
Figure 12
yum install ulteo-ovd-web-client ulteo-ovd-web-client-ajaxplorer ulteo-ovd-guacamole
The HTML5 client is enabled by installing ulteo-ovd-guacamole package. By default, it's based on using Tomcat 6 server.
Launch the configuration tool:
ovd-web-client-config
Figure 13
Configure and restart tomcat and apache:
service httpd restart
chkconfig tomcat6 on
service tomcat6 restart
chkconfig guacd on
service guacd start
Now, you need to open port 80 on your web portal server. Run the following command:
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
then go to the link below to open the Web Portal:
http://web.ovd.com/ovd/
Figure 14
By using HTML5, you will find out that how much it’s fast. Thanks to HTML5. And you have 2
modes. Desktop mode and Portal mode. Desktop mode gives you a familiar environment, like
desktop computers. Portal mode gives you tile icons which is really good for use in smart
phones. I will show you in part 2 of this article.
other words, merging both Linux and Windows applications together and using them in
browser or desktop mode. Now, in order to add a Windows Application server, we need either
a Windows 2003 or a Windows server 2008 or a Windows server 2012.
Next, download Ulteo Open Virtual Desktop Windows agent from link below and install it in
Windows server:
http://www.ulteo.com/main/downloads/ulteoovdwin.php
OVD Windows agent installation is fairly easy but I will show here:
Click Next,
Figure 15
Leave the default and click Next. Then, you can either put IP address or fqdn of Session
Server:
Figure 16
Click on Next and installation will start. After installation finished, click on Reboot to reboot
your server:
Figure 17
Then go back to admin page and click on Servers >Unregistered Servers. You should see
the Windows server there. Click on Register button:
Figure 18
Next, click on IP address under Name column:
Figure 19
Display name: Win Apps → Whatever name you like and then click on Define
Internal name (fqdn): IP address of Win Server → then click on Change
Redirection name for this server: IP address of Win Server → then click Change
Then click on Switch to production:
Figure 20
and finally you should the following servers on Server page (figure 21)
Figure 21
This is the end of part 1. In part 2, I will show you how to configure Session Manager to serve
both Linux and Windows applications.
Hope you enjoyed,
Khosro Taraghi
Today, I am very excited to talk about Open Virtual Desktop (OVD). If you are looking for
merging Linux and Windows applications and access them all over Internet/network via your
browser, desktop, tablets, or your smart phone with the same speed as running those
applications on the actual server, OVD is that what you need.
OVD has two editions. One is Community Edition (free edition) that we are going to talk about
that today and the other one is Enterprise Edition. Both have the same functionality except
that Enterprise edition has support, updates, patches, native client and the SSL gateway for
access via the Internet.
To install and configure the OVD, we need at least 3 or 4 servers in production environments
(a Session Manager, an Application Server or Subsystem, a Windows Server
(2003/2008/2012 only) for Windows applications, a Web Portal and a
SSL/Gateway(enterprise only) for production environment), however, for demonstrating
purposes and lack of resources, I am going to install all of them in one server except Windows
server. So, total 2 servers for my purpose.
The server that I am working on is CentOS 6.6 but the process of installation should be the
same as all RedHat families. Let’s install OVD:
The first thing you need to do is disabling SELinux because Ulteo OVD is not compatible with
SELinux yet, which I don’t like to disable SELinux personally but no choice for now:
sestatus
vi /etc/selinux/config and set SELINUX=disabled
reboot
Figure 1
Then, you need to add Ulteo rpm repository into your server. Create a file called ovd.repo in
/etc/yum.repos.d/ and add following lines in the file:
vi /etc/yum.repos.d/ovd.repo
[ovd4.0.2]
name=Ulteo OVD 4.0.2
baseurl=http://archive.ulteo.com/ovd/4.0/rhel/6.0/
enabled=1
gpgcheck=1
gpgkey=http://archive.ulteo.com/ovd/4.0/rhel/6.0/keyring
Figure 2
Session Manager Installation:
First, you need to create a database. The easiest way to install a database is MySQLdatabase. To install MySQL and create a database for Session Manager, follow the
instructions below:
yum install mysql mysqlserver → install MySQL package
chkconfig mysqld on → To start automatically MySQL when the system boots up
service mysqld start → Start the service
mysqladmin -u root password 'your_password_here' → Define the root mysql password
mysql -u root -p -e 'create database ovd' → Create a database for ovd Session Manager
Now, install Session Manager and Administration Console:
yum install ulteo-ovd-session-manager ulteo-ovd-administration-console
Launch the configuration tool (needs access to Internet):
sm-config
Figure 3
Launch the Administration Console configuration tool (press Enter to accept the default local
host address if the Session Manager is in the same machine or enter the ip address of
Session Manager):
ovd-administration-console-config
Figure 4
Restart Apache service:
chkconfig httpd on → To start automatically Apache when the system boots up
service httpd restart
Since I don’t have DNS server here, I am going to use host entry in /etc/hosts file. We need 3
FQDN records (Session Manager, Application Server, Web Portal):
vi /etc/hosts → add following lines below:
127.0.0.1 sm.ovd.com
127.0.0.1 app.ovd.com
127.0.0.1 web.ovd.com
Now, we need to configure our Session Manager. Go to this url:
http://sm.ovd.com/ovd/admin
and login to admin page:
Figure 5
Since this is the first time that you login to admin, it will redirect you to setup page for
database. Enter your root credentials for database and click Save:
Figure 6
Now, you need to adjust the timezone in PHP setting, do the followings:
vi /etc/php.ini
date.timezone = America/Toronto → Change the timezone accordingly; you can find a list
of timezones here: http://php.net/manual/en/timezones.php
then, restart apache:
service httpd restart
Figure 7
Application Server / File Server Installation:
It’s time to set up your Application Server or Subsystem. First, you need to install yoursubsystem package:
yum install ulteo-ovd-subsystem
Due to a conflict, you may have to uninstall samba packages before installing the
ulteo-ovd-session-manager package. Remove the samba client and server packages:
yum remove samba*
then launch the configuration tool:
ovd-subsystem-config
Figure 8
Configure and start the Ulteo service:
chkconfig ulteo-ovd-subsystem on
service ulteo-ovd-subsystem restart
Now that you have installed and configured your Application or Subsystem, go back to admin
page and click on Unregistered servers under Servers and you will see your Application
server is there. Just click on Register to register your Application server.
Figure 9
After clicking on Register button, if you have followed my instructions, you may see the
following message:
Server "localhost": redirection name may be invalid!
Figure 10
To fix that, click on localhost and enter the following info:
Display name: Linux Apps → Whatever name you like and then click on Define
Internal name (fqdn): localhost → use localhost and then click on Change
Redirection name for this server: app.ovd.com → I used fqdn that I defined in /etc/hosts and
then click Change
I disabled fs role since I don’t want to use it.
Then click on Switch to production button.
Note:
The redirection name is used when launching sessions. When you launch a session, you are
redirected to an Application Server using the redirection name as target host.
Figure 11
Figure 12
Web Portal Installation:
We need the following packages to install Web Portal:yum install ulteo-ovd-web-client ulteo-ovd-web-client-ajaxplorer ulteo-ovd-guacamole
The HTML5 client is enabled by installing ulteo-ovd-guacamole package. By default, it's based on using Tomcat 6 server.
Launch the configuration tool:
ovd-web-client-config
Figure 13
Configure and restart tomcat and apache:
service httpd restart
chkconfig tomcat6 on
service tomcat6 restart
chkconfig guacd on
service guacd start
Now, you need to open port 80 on your web portal server. Run the following command:
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
then go to the link below to open the Web Portal:
http://web.ovd.com/ovd/
Figure 14
By using HTML5, you will find out that how much it’s fast. Thanks to HTML5. And you have 2
modes. Desktop mode and Portal mode. Desktop mode gives you a familiar environment, like
desktop computers. Portal mode gives you tile icons which is really good for use in smart
phones. I will show you in part 2 of this article.
Windows Application Server Installation:
The goal was configuring OVD to serve both Linux and Windows application in one place. Inother words, merging both Linux and Windows applications together and using them in
browser or desktop mode. Now, in order to add a Windows Application server, we need either
a Windows 2003 or a Windows server 2008 or a Windows server 2012.
Next, download Ulteo Open Virtual Desktop Windows agent from link below and install it in
Windows server:
http://www.ulteo.com/main/downloads/ulteoovdwin.php
OVD Windows agent installation is fairly easy but I will show here:
Click Next,
Figure 15
Leave the default and click Next. Then, you can either put IP address or fqdn of Session
Server:
Figure 16
Click on Next and installation will start. After installation finished, click on Reboot to reboot
your server:
Figure 17
Then go back to admin page and click on Servers >Unregistered Servers. You should see
the Windows server there. Click on Register button:
Figure 18
Next, click on IP address under Name column:
Figure 19
Display name: Win Apps → Whatever name you like and then click on Define
Internal name (fqdn): IP address of Win Server → then click on Change
Redirection name for this server: IP address of Win Server → then click Change
Then click on Switch to production:
Figure 20
and finally you should the following servers on Server page (figure 21)
Figure 21
This is the end of part 1. In part 2, I will show you how to configure Session Manager to serve
both Linux and Windows applications.
Hope you enjoyed,
Khosro Taraghi
Friday, January 30, 2015
PowerTop
Hello all,
Today, I would like to talk about a very interesting tool
called Powetop. This tool is used for power consumption and power management
and it finds and diagnosis different issues with powers. Using laptops when
it’s on battery, this tool can help a lot to save battery and use laptop for
longer time. For example, when you are editing a text file, there is no need to
use wifi. And even though you are not using wifi, still it consumes power for
its Idle time. So you can minimize power consumption of wifi when you are not
using it and it’s idle.
CPU is also consuming power a lot. When CPU is idle, operation
system can put it to sleep mode to save more power. When OS commands CPU to
enter to a low power state (there are different lower states), these “lower states”
called CPU C-states and it operates
on a per core basis. All C-states (C1 to Cn) put different parts of processor
to power down. C0 means no sleep and it’s up and fully operational.
There is another term that you should know as well and it’s Package C-states or PCx. When all cores agree to enter a specific C-state, it’s called
PCx. For example, if there are 2 cores and one is at C1 and the other one is
C3, the Package C-state will be C1 (highest one).
You can install powertop tool either with yum command or by
compiling actual package. The easiest way is yum command:
yum install powertool
However, if you want to download and install the latest version
of powertool manually, do the followings:
tar -txvf
powertop-2.7.tar.gz
cd powertop-2.7.tar.gz
./configure
make
make install
To run powetool:
/usr/local/sbin/powertop
Figure 1
Powetop has different tabs. The first tab is Overview and it
shows the usage, number of event per second, category, description and power
estimate of items. When you tune applications for power consumption, the number
of wakeups per second should be less which means more system’s power. To see the power estimate column on Overview tab, make sure
there is no file under /var/cache/powertop and system has to be running on battery power only. It takes
time to calculate and measure power (in terms of Watt). "Kwork" in
Category column is a placeholder process for kernel worker threads, which
perform most of the actual processing for the kernel, especially in cases where
there are interrupts, timers, I/O, etc.
Second tab is Idle State. It shows CPU’s usage currently in the
system and also it shows the current C-state of each CPU. It also shows the
same C-state by Core and Package(PCx).
Figure 2
Third tab is Frequency Stats which is frequency of cpu in terms
of GHZ in relationship with the idle state.
Figure 3
Fourth tab is Device Stats tab. It shows devices that consume
power. Figure 4.
Figure 4
Fifth tab is Tunables
tab, which is my favorite tab. It lists all devices that are not tuned for
power management and it’s marked as “Bad”. You can toggle it by pressing
“enter” from Bad to Good. Now, remember that when you reboot the machine, it’s
gone and system marks it as “Bad” again. If you want to save the setting
permanently, the command that you have to put it in .bashrc file is showing on the top when you toggle it. In this
case, it is:
echo ‘auto’ > /sys/bus/pci/devices/0000:00:15.0/power/control
Figure 5
so, do this:
cd ~
vi .bashrc
echo ‘auto’ >
/sys/bus/pci/devices/0000:00:15.0/power/control
save it.
Now, when you run powertop without any options, it goes to
interactive mode. You can store the report on html or csv file format:
powertop --html=mypowertop.html
or
powertop --csv=mypowertop.csv
Also, you can let it run for some amount of seconds:
powertop --html=mypowertop.html --time=10
Figure 6
Hope you enjoyed.
Khosro Taraghi
Sunday, November 30, 2014
Disk Monitoring (Part 1)
Hello All,
Today, I would like to talk about a monitoring tool for physical disks (iostat). It is a very great tool if you want to watch and improve your disk's performance. It monitors system input/output device loading by observing the time the devices are active in relation to their average transfer rates. Therefore, it can be used to change system configuration to better balance the input/output load between physical disks.
iostat
To find out which package contains iostat utility, run the below command:
yum whatprovides "*/iostat"
Figure 1
Install iostat:
yum install sysstat
Running iostat without any parameters will make a report at the time of running command (just one instance):
Figure 2
It generates two types of reports, the Cpu Utilization report and the Device or Disk Utilization report.
According to man page,
%user : Show the percentage of CPU utilization that occurred while executing at the user level (application).
%nice : Show the percentage of CPU utilization that occurred while executing at the user level with nice priority.
%system : Show the percentage of CPU utilization that occurred while executing at the system level (kernel).
%iowait : Show the percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.
%steal : Show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor.
%idle : Show the percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.
tps : Indicate the number of transfers per second that were issued to the device.
kB_read/s : Indicate the amount of data read from the device expressed in kilobytes per second.
kB_wrtn/s : Indicate the amount of data written to the device expressed in kilobytes per second.
kB_read : The total number of blocks read.
kB_wrtn : The total number of blocks written.
If you want to make a report just for Cpu utilization, use "-c" parameters OR use just "-d" for Device Utilization:
iostat -c
iostat -d
To display statistics in megabytes per second use "-m":
Figure 3
To run iostat command continuously, we need an interval parameter without any count parameter. For example, to run iostat each every 3 senonds continuously, we need the below command:
iostat -d 3
Figure 4
To run iostat command by specifying the amount of time in seconds between each report and stops after some number of counts, we need a count paramater after interval parameter. For example, to generate a report running in each 3 seconds and stops after 2 counts, we need the below command:
iostat -d 3 2
Figure 5
Use "-x" parameter to extend the report for more statistics:
iostat -x
Figure 6
If you need statistics just for one specific disk, for example dm-0, run the below command:
iostat -x dm-0
Figure 7
Disadvantage of iostat command is that you can't find out which process or application is acting up or causing issues on that particular device if there is. In next part, I will talk about iotop command to address this.
Hope you enjoyed,
Khosro Taraghi
Today, I would like to talk about a monitoring tool for physical disks (iostat). It is a very great tool if you want to watch and improve your disk's performance. It monitors system input/output device loading by observing the time the devices are active in relation to their average transfer rates. Therefore, it can be used to change system configuration to better balance the input/output load between physical disks.
iostat
To find out which package contains iostat utility, run the below command:
yum whatprovides "*/iostat"
Figure 1
Install iostat:
yum install sysstat
Running iostat without any parameters will make a report at the time of running command (just one instance):
Figure 2
It generates two types of reports, the Cpu Utilization report and the Device or Disk Utilization report.
According to man page,
%user : Show the percentage of CPU utilization that occurred while executing at the user level (application).
%nice : Show the percentage of CPU utilization that occurred while executing at the user level with nice priority.
%system : Show the percentage of CPU utilization that occurred while executing at the system level (kernel).
%iowait : Show the percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.
%steal : Show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor.
%idle : Show the percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.
tps : Indicate the number of transfers per second that were issued to the device.
kB_read/s : Indicate the amount of data read from the device expressed in kilobytes per second.
kB_wrtn/s : Indicate the amount of data written to the device expressed in kilobytes per second.
kB_read : The total number of blocks read.
kB_wrtn : The total number of blocks written.
If you want to make a report just for Cpu utilization, use "-c" parameters OR use just "-d" for Device Utilization:
iostat -c
iostat -d
To display statistics in megabytes per second use "-m":
Figure 3
To run iostat command continuously, we need an interval parameter without any count parameter. For example, to run iostat each every 3 senonds continuously, we need the below command:
iostat -d 3
Figure 4
To run iostat command by specifying the amount of time in seconds between each report and stops after some number of counts, we need a count paramater after interval parameter. For example, to generate a report running in each 3 seconds and stops after 2 counts, we need the below command:
iostat -d 3 2
Figure 5
Use "-x" parameter to extend the report for more statistics:
iostat -x
Figure 6
If you need statistics just for one specific disk, for example dm-0, run the below command:
iostat -x dm-0
Figure 7
Disadvantage of iostat command is that you can't find out which process or application is acting up or causing issues on that particular device if there is. In next part, I will talk about iotop command to address this.
Hope you enjoyed,
Khosro Taraghi
Thursday, October 30, 2014
Stress Command
Hello all,
Today, I am going to talk about Stress command. It's a very useful and easy command if you want to impose load and stress on your systems/servers and then review the result of running your application or whatever it is under pressure. For example, if you want to review your application's performance or your website's performance under a busy server, you can use this command; let's say you know your web server is working fine with 100 customers connected at the same time to your web server in a regular business day, which is usually the case in your company, and it uses 30% of your server's cpu roughly, but how is your web server's performance working when your company has a good sale or it's close to the end of year, boxing day for instance? And you know that your connected customers to your web server would increase by 50% at that moment. It's too late if you find out that your application is poor in memory managment or has a memory leak or whatever reason on that day and your website goes down under heavy loads and whatelse, your company will lose money. So, you can predict/pervent that situation by increasing cpu and memory using this command and simulate the exact situation and then figure out the problem in your application or servers.
Here is how it works:
First you need to install stress command:
yum install stress
By the way, you can stress your system by cpu, memory, io, hdd, or a combination of them. You can get a list of options and parameters in manpage as well.
Example 1:
Bring the system load average up to an arbitrary value for cpu. In this example, it forks 4 processes with calculating the sqrt() of a random number acquired with rand() function.
stress -c 4
or
strss --cpu 4 --timeout 15
"--timeout 15" means timeout after 15 seconds
Figure 1 (before running command)
Figure 2 (after running command)
Example 2:
To see how your system performs when it is I/O bound, use the -i switch.
stress -i 4
or
stress --io 4
This will call sync() which is a system call that flushes memory buffers to disk.
Of course, you can combine above commands like:
stress -c 4 -i 4 --verbose --timeout 15
Example 3:
Now, let's try memory stress. The following command forks 7 processes each spinning on malloc():
stress -m 7 --timeout 15
or
stress --vm 7 --timeout 15
Figure 3 (before running command)
Figure 4 (after running command)
According to manpage, we can use --vm-hang option which instructs each vm hog process to go to sleep after allocating memory. This contrasts with their normal behavior, which is to free the memory and reallocate it. This is useful for simulating low memory conditions on a machine. For example, the following command allocates 512M (2 x 256M) of RAM and holds it until killed (after 10 seconds).
stress --vm 2 --vm-bytes 128M --vm-hang 10
Figure 5
And here is what manpage says about stress command:
'stress' is not a benchmark, but is rather a tool designed to put given subsytems under a specified load. Instances in which this is useful include those in which a system administrator wishes to perform tuning activities, a kernel or libc programmer wishes to evaluate denial of service possibilities, etc.
And pretty much that's it. I hope you enjoyed. Don't forget to put your comments here.
Thanks all,
Khosro Taraghi
Today, I am going to talk about Stress command. It's a very useful and easy command if you want to impose load and stress on your systems/servers and then review the result of running your application or whatever it is under pressure. For example, if you want to review your application's performance or your website's performance under a busy server, you can use this command; let's say you know your web server is working fine with 100 customers connected at the same time to your web server in a regular business day, which is usually the case in your company, and it uses 30% of your server's cpu roughly, but how is your web server's performance working when your company has a good sale or it's close to the end of year, boxing day for instance? And you know that your connected customers to your web server would increase by 50% at that moment. It's too late if you find out that your application is poor in memory managment or has a memory leak or whatever reason on that day and your website goes down under heavy loads and whatelse, your company will lose money. So, you can predict/pervent that situation by increasing cpu and memory using this command and simulate the exact situation and then figure out the problem in your application or servers.
Here is how it works:
First you need to install stress command:
yum install stress
By the way, you can stress your system by cpu, memory, io, hdd, or a combination of them. You can get a list of options and parameters in manpage as well.
Example 1:
Bring the system load average up to an arbitrary value for cpu. In this example, it forks 4 processes with calculating the sqrt() of a random number acquired with rand() function.
stress -c 4
or
strss --cpu 4 --timeout 15
"--timeout 15" means timeout after 15 seconds
Figure 1 (before running command)
Figure 2 (after running command)
Example 2:
To see how your system performs when it is I/O bound, use the -i switch.
stress -i 4
or
stress --io 4
This will call sync() which is a system call that flushes memory buffers to disk.
Of course, you can combine above commands like:
stress -c 4 -i 4 --verbose --timeout 15
Example 3:
Now, let's try memory stress. The following command forks 7 processes each spinning on malloc():
stress -m 7 --timeout 15
or
stress --vm 7 --timeout 15
Figure 3 (before running command)
Figure 4 (after running command)
According to manpage, we can use --vm-hang option which instructs each vm hog process to go to sleep after allocating memory. This contrasts with their normal behavior, which is to free the memory and reallocate it. This is useful for simulating low memory conditions on a machine. For example, the following command allocates 512M (2 x 256M) of RAM and holds it until killed (after 10 seconds).
stress --vm 2 --vm-bytes 128M --vm-hang 10
Figure 5
And here is what manpage says about stress command:
'stress' is not a benchmark, but is rather a tool designed to put given subsytems under a specified load. Instances in which this is useful include those in which a system administrator wishes to perform tuning activities, a kernel or libc programmer wishes to evaluate denial of service possibilities, etc.
And pretty much that's it. I hope you enjoyed. Don't forget to put your comments here.
Thanks all,
Khosro Taraghi
Subscribe to:
Posts (Atom)