Tornado Web Server multi-process start two methods, tornadoweb

Source: Internet
Author: User
Tags high cpu usage

Tornado Web Server multi-process start two methods, tornadoweb

I. Introduction to Tornado

Tornado is an open-source version of FriendFeed's Web server and common tools. Tornado differs significantly from the current mainstream Web Server framework (including most Python frameworks): It is a non-blocking server and is fast. Tornado can process thousands of connections per second based on its non-blocking method and epoll application. Therefore, Tornado is an ideal framework for real-time Web services.

Ii. multi-process startup Method

Normal start method:

Copy codeThe Code is as follows:
Server = HTTPServer (app)
Server. listen (8888)
IOLoop. instance (). start ()

Multi-process, solution 1:

Copy codeThe Code is as follows:
Server = HTTPServer (app)
Server. bind (8888)
Server. start (0) # Forks multiple sub-processes
IOLoop. instance (). start ()

Multi-process, solution 2:

Copy codeThe Code is as follows:
Sockets = tornado. netutil. bind_sockets (8888)
Tornado. process. fork_processes (0)
Server = HTTPServer (app)
Server. add_sockets (sockets)
IOLoop. instance (). start ()


Why are N processes with the same name in Linux not entered!

If the process name is the same, it does not mean that the pid of the process is the same. In windows, you can also open 2 word and 2 qq. For example, Apache (web server software), if it adopts the multi-process method, it will generate dozens of identical processes to concurrently process http requests. The same is true for mysql. You can modify the number of concurrent processes in the/etc/my. cnf configuration file. Even I can run two unrelated two source programs. They do not share the code segment, nor are they parent-child or sibling processes.
I Don't Understand java, but when my colleagues write java, there will be many similar processes in windows. I think this is related to the principle of the java interpreter. Dare not speak falsely ~~~~

The system is occupied by many processes and runs slowly. How can this problem be solved?

100% CPU usage in Win and Solution

When using the Windows operating system, the CPU usage slows down. When we look at "Task Manager", we find that the CPU usage reaches 100%. How did this happen? In this article, I will explain why the system resource usage reaches 100% from three aspects: hardware, software, and virus.

CPU usage is usually 100%, and the main problems may occur in the following aspects:

Nine possibilities of high CPU usage

1. Anti-virus software faults

The new versions of KV, Kingsoft, and rising all add random monitoring of web pages, plug-ins, and emails, which undoubtedly increases the burden on the system. Solution: Basically there is no reasonable solution. Try to use the least monitoring service or upgrade your hardware.

2. the driver has not been certified, resulting in 100% CPU resource usage

A large number of Beta drivers are flooding the Internet, leading to hard-to-find fault causes. Processing Method: especially for graphics card drivers, it is recommended that you use a Microsoft-certified or officially released driver and strictly check the model and version.

3. caused by viruses and Trojans

A large number of worms rapidly replicate within the system, resulting in a high CPU usage rate. Solution: use reliable anti-virus software to thoroughly clean up the system memory and local hard disk, and enable the system setting software to check for programs with startup exceptions. Update and Upgrade anti-virus software and firewall regularly to enhance anti-virus awareness and master the correct anti-virus knowledge.

4. Right-click Control Panel-Administrative Tools-SERVICE-rising realtime monitor service and choose manual.

5. Start-> Run-> msconfig-> Start, disable unnecessary start items, and restart.

6. view the "svchost" process.

Svchost. exe is a core process of Windows XP. Svchost.exe not only appears in Windows s XP, but also exists in Windows systems using the NT kernel. Generally, in Windows 2000, the number of svchost.exe processes is 2, while in Windows XP, the number of svchost.exe processes has increased to 4 and more.

7. View network connections. This is mainly for NICs.

8. View Network Connections

When a computer with Windows XP installed as a server receives a connection request from port 445, it allocates memory and a small amount of CPU resources to provide services for these connections. When the load is too heavy, the CPU usage may be too high, because there is an inherent trade-off between the number of work items and the response capability. Determine the appropriate MaxWorkItems settings to improve the system response capability. If the set value is incorrect, the server's response capability may be affected, or a user excludes too many system resources.

To solve this problem, we can modify the Registry: in the Registry Editor, expand the [HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ lanmanserver] branch in sequence, create a DWORD Value named "maxworkitems" in the right-side window. Double-click the value. In the displayed window, type the following values and save and exit:

If the computer has more than 1024 MB of memory, type "512"; if the computer memory is less than 256 MB, type ".

9. Check if the right-click Windows XP causes 100% CPU usage

Recently, I reported that right-clicking the resource manager will cause 100% of CPU resources to be occupied. Let's see what's going on?

Symptoms:

In resource manager, When you right-click a directory or file, you may encounter the following problems:

... The remaining full text>

Related Article

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.