A Python server program performance analysis

Source: Internet
Author: User

The server is Bono and starts 11 processes.

The total ingress settings for the start service cprofile

if __name__= ="__main__"    :import  cProfile    Cprofile.run ('main ()','bono.profile')

Use the time in the command line to run

$ time Python xxx.py   # # #

The service runs continuously, waits a few seconds, stops the service, displays on the command line: Analysis wait time is 16.793 (17.709-0.792-0.124), kernel run time is 0.124, user state run time 0.792

Real    0m17.709suser    0m0.792ssys    0m0.124s

Profiling a profile using Runsnake: Sort by local (this function does not include child functions)

The time.sleep is approximately 16.95 seconds, which is similar to the time command analysis, and the active sleep duration for the service.

Column name meaning: number of calls, relative number of calls, local execution time, average local execution time, total execution time, average execution, file name, row name, directory name

Click on the left side of the line, on the right side can show the function inside the call and spend time. The area is the time size.

A Python server program performance analysis

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.