Linux under Load Locustio

Source: Internet
Author: User

Upgrade Python version

#python

centOS6.8 installed in the default version 2.6, because I install to the back of the error Python version is lower, so you can first upgrade the Python version to 2.7;

Enter directly at the command line: #wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz for download

Decompression: TAR-ZXVF python-2.7.11.tgz

Enter the Python-2.7.11 directory input./configure

#make

#make Install

At this point, you can view the next Python version directly from #python, or the original default version

Execution: mv/usr/bin/python/usr/bin/python2.6-20170425 Renaming the previous Python directory

Ln-s/usr/local/bin/python2.7/usr/bin/python The current Python link to/usr/bin/python

If you look again, the Python version has been updated.

5. Download pip

If the version of the PIP was installed to be too low, or if the python was updated again, Pip is basically a reload, but fortunately, the method is simple:

Because Python provides a get-pip.py address, such as right: https://bootstrap.pypa.io/get-pip.py

Download the installation directly under Linux: Curl https://bootstrap.pypa.io/get-pip.py | Python

By completing the above steps, you have successfully installed the PIP so that you can pack whatever package you want to load.

Pip Install xxx

Installing LOCUST:PIP Install Locustio

If the PIP has a dependent module let's install what you want yum install anything

Error Importerror:cannot Import name Httpshandler words installed

Yum Install Openssl-y
Yum Install Openssl-devel-y
When the installation is complete, be sure to reinstall python!!!! Again pip install Locustio

6. Reconfigure Yum

Some students may be installed in the back of the need to upgrade Python, then after the upgrade, Yum can not be used, yum can not be used in future work to waste a lot of time, so it is necessary to re-engage Yum, the method is super simple:

# Vi/usr/bin/yum #打开yum命令文件, change the first line of script start address

This is where the path in the red circle changes to the old Python package's new path name when you upgrade Python:/usr/bin/python2.6-20170425

So it's done. Locust, Pip, yum


7. After all of the above steps have been completed, at the command line input: #locust-H, if come out similar to help as the result of locust has been installed successfully

8. Create a folder for your own Python script: Eg:/home/roger/pythonfile

Write a test script: test.py

From Locust import locust, TaskSet, task


Class Userbehavior (TaskSet):
@task
def job (self):
Pass


Class User (Locust):
Task_set = Userbehavior
min_wait = 1000
max_wait = 3000


After the script is written, in the directory where the script is located, import the script file: #locust-F test.py

The following result is the successful start of monitoring:


Open the Firefox browser in CentOS, type: 127.0.0.1:8089


After that, the various use techniques of the locust have been studied.

Linux under Load Locustio

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.