Publish a python service framework iserver (with stress test data)

Source: Internet
Author: User

Publish a python service framework iserver (with stress test data)
Iserver introduction Iserver is a network service framework (compiled version 3.4.1) Written in python. It uses the epool Network Model Tester to configure the processor 2x Genuine Intel (R) CPU T2050 @ 1.60 GHz memory 2060 MB (673 MB used) number of processes enabled by nginx root 2413 2409 2414 0 00:00:00 pts/0 grep-I nginx www 2411 2? 00:00:00 nginx: worker process www 2415 2411 0? 00:00:00 nginx: master process www 2416 2411 0? 00:00:00 nginx: master process www 2417 2411 0? 00:00:00 nginx: master process www 2418 2411 0? 00:00:00 nginx: master process www 2419 2411 0? 00:00:00 nginx: master process www 2420 2411 0? 00:00:00 nginx: master process www 2421 2411 0? 00:00:00 nginx: Eight nginx processes in the master process consume 120 MB of memory (15 MB * 8 = 2424 MB). php-cgi: Number of processes enabled: root 1 0? 00:00:00 php-fpm: master process www 2425 2424 0? 00:00:00 php-fpm: pool www 2426 2424 0? 00:00:00 php-fpm: pool www 2427 2424 0? 00:00:00 php-fpm: pool www 2428 2424 0? 00:00:00 php-fpm: pool www 2429 2424 0? 00:00:00 php-fpm: pool www 2430 2424 0? 00:00:00 php-fpm: pool www 2431 2424 0? 00:00:00 php-fpm: pool www 2432 2424 0? 00:00:00 php-fpm: pool www 2433 2424 0? 00:00:00 php-fpm: pool www 2434 2424 0? 00:00:00 php-fpm: pool www 2435 2424 0? 00:00:00 php-fpm: the pool www enables 12 php-cgi processes to consume 240 MB of memory (20 M * 12 = M). The test process is to first start the queue network service, php inserts an insert SQL statement into the queue service, such as client. php copy code 1/** 2 * socket client 3 * a NULL fill string 4 * n table-style unsigned short integer 5 * unsigned short integer, always 16 points, large-end 6 */7 function insert_queue ($ cmd, $ SQL) {8 $ s = socket_create (AF_INET, SOCK_STREAM, SOL_TCP); 9 try {10 socket_connect ($ s, "127.0.0.1", 8888); 11 $ list = json_encode (array (12 "SQL" => $ sql13); 14 $ Len = strlen ($ list); 15 $ param = pack ("nna {$ len}", $ cmd, $ len, $ list); 16 socket_write ($ s, $ param, strlen ($ param); 17 socket_recv ($ s, $ head, 4, 0); 18 // var_dump ($ head); 19 if ($ head! = '') {20 $ a = unpack (" ncmd/nlen ", $ head); 21 $ cmd = $ a ['cmd']; 22 $ len = $ a ['len']; 23 if ($ cmd = 8001) {24 socket_recv ($ s, $ body, $ len, 0 ); 25 // echo $ body; exit; 26 $ B = json_decode ($ body, true); 27 socket_close ($ s); 28 return $ B; 29} 30} 31 socket_close ($ s); 32} catch (Exception $ e) {33 echo $ e-> getMessage (); 34} 35} 36 $ temp = insert_queue (8001, "insert into (num) values (% d)"); copy the code CircularQueue. py copy code 1 #! /Usr/bin/python 2 # coding = UTF-8 3 #4 # @ Author: LiXiaoYu 5 # @ Time: 2013-11-06 6 # @ Info: CircularQueue Server. 7 8 import Epoll 9 from Config import Config10 from App. queue. circularQueue import CircularQueue11 12 # Get Queue service configuration 13 _ config = Config ("Queue") 14 15 # Initial Parameter 16 _ port = _ config. get ("queue. port ") # service port 17 _ app = CircularQueue () 18 # _ allow_ip = ['2017. 168.1.100'] # whitelist IP address list 19 20 # Start Service 21 s = Epoll. crea TeServer (_ app) 22 # s. setAllowIp (_ allow_ip) 23 s. listen (_ port) 24 25 start service 26 python3 circularQueue. py copy code test tool uses webbench to simulate 10 thousand concurrent webbench-c 10000-t 30 http: // 192.168.1.100/client. php test result lxy @ lenovo-pc :~ $ Webbench-c 10000-t 30 http: // localhost/client. php Webbench-Simple Web Benchmark 1.5 Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software. benchmarking: GET http: // 192.168.1.100/client. php 10000 clients, running 30 sec. speed = 43226 pages/min, 129975 bytes/sec. requests: 21613 susceed, 0 failed. the number of requests per minute is 43226 pages/min, and the amount of data transmitted per second is 129975 bytes/sec, which is equivalent to 43226*60*24 = 62245440 requests per day.

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.