{ "info": { "author": "prprprus", "author_email": "huangzongzhuan@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# viola\n\n[![build status](https://travis-ci.org/prprprus/viola.svg?branch=master)](https://travis-ci.org/prprprus/viola.svg?branch=master) [![pip version](https://img.shields.io/badge/pip-v18.1-blue.svg)](https://img.shields.io/badge/pip-v18.1-blue.svg) [![license](https://img.shields.io/dub/l/vibe-d.svg)](./LICENSE)\n\n[\u4e2d\u6587](https://github.com/prprprus/viola/blob/master/README_CN.md)\n\nviola is a WSGI server. Lightweight and efficient and has no dependencies other than the Python Standard Library. Usually used with Nginx. I build [blog](http://hentaiuih.us/) with viola, handle static resource by Nginx and dynamic content with viola. You can also do this or using viola as a reference for learn networking programming.\n\nTable of content:\n\n- [Features](https://github.com/prprprus/viola#features)\n- [Requirements](https://github.com/prprprus/viola#requirements)\n- [Installation](https://github.com/prprprus/viola#installation)\n- [Example](https://github.com/prprprus/viola#example)\n- [Performance](https://github.com/prprprus/viola#performance)\n- [TODO](https://github.com/prprprus/viola#todo)\n- [Reference](https://github.com/prprprus/viola#reference)\n- [License](https://github.com/prprprus/viola#license)\n- [Contributing](https://github.com/prprprus/viola#contributing)\n\n## Features\n\n+ [x] Single-thread, non-blocking I/O based on event-driven model\n+ [x] Simplified WSGI protocol for server side\n+ [x] Second timer\n+ [x] A parser for HTTP GET method\n\n## Requirements\n\n- Python\n - CPython >= 3.6\n- Platform\n - Linux and kernel >= 2.6\n\n## Installation\n\nPackage is uploaded on [PyPI](https://pypi.org/project/viola/)\n\nYou can install with pip:\n\n```\n$ pip install viola\n```\n\n## Example\n\nUse viola as follows:\n\n```python\nfrom viola.core.event_loop import EventLoop\nfrom viola.wsgi.server import WSGIServer\nfrom viola.core.scheduler import Scheduler\n# Import your APP in here\n\n\nif __name__ == '__main__':\n event_loop = EventLoop.instance(Scheduler.instance())\n server = WSGIServer(event_loop)\n server.set_wsgi_app(APP) # For example the APP argument is flask or bottle\n server.bind(host=HOST, port=PORT) # Replace your real host and real port\n server.listen()\n server.start(1)\n event_loop.start()\n```\n\nThat's all.\n\n## Performance\n\nThe following nginx are proxy with one WSGI server. Nginx configuration is consistent and the WSGI server response a string \"Hello World\".\n\n```\nCPU: 2.7 GHz Intel Core i5\nMEM: 8 GB 1867 MHz DDR3\n```\n\n```\nab -n 10000 -c 500 http://10.211.55.25/\n```\n\n#### Nginx + Tornado(Tornado as both a WSGI server and Web framework. Tornado start one process)\n\n```\n$ ab -n 10000 -c 500 http://10.211.55.25/\nThis is ApacheBench, Version 2.3 <$Revision: 1528965 $>\nCopyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\nLicensed to The Apache Software Foundation, http://www.apache.org/\n\nBenchmarking 10.211.55.25 (be patient)\nCompleted 1000 requests\nCompleted 2000 requests\nCompleted 3000 requests\nCompleted 4000 requests\nCompleted 5000 requests\nCompleted 6000 requests\nCompleted 7000 requests\nCompleted 8000 requests\nCompleted 9000 requests\nCompleted 10000 requests\nFinished 10000 requests\n\n\nServer Software: nginx/1.15.8\nServer Hostname: 10.211.55.25\nServer Port: 80\n\nDocument Path: /\nDocument Length: 12 bytes\n\nConcurrency Level: 500\nTime taken for tests: 31.186 seconds\nComplete requests: 10000\nFailed requests: 0\nTotal transferred: 2190000 bytes\nHTML transferred: 120000 bytes\nRequests per second: 320.65 [#/sec] (mean)\nTime per request: 1559.316 [ms] (mean)\nTime per request: 3.119 [ms] (mean, across all concurrent requests)\nTransfer rate: 68.58 [Kbytes/sec] received\n\nConnection Times (ms)\n min mean[+/-sd] median max\nConnect: 0 1 3.3 0 20\nProcessing: 13 797 3684.3 121 31161\nWaiting: 9 797 3684.3 121 31161\nTotal: 28 798 3686.2 122 31170\n\nPercentage of the requests served within a certain time (ms)\n 50% 122\n 66% 132\n 75% 141\n 80% 149\n 90% 168\n 95% 1002\n 98% 15038\n 99% 15135\n 100% 31170 (longest request)\n```\n\n#### Nginx + Gunicorn(workers 4 and use sync mode by default) + bottle\n\n```\n$ ab -n 10000 -c 500 http://10.211.55.25/\nThis is ApacheBench, Version 2.3 <$Revision: 1528965 $>\nCopyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\nLicensed to The Apache Software Foundation, http://www.apache.org/\n\nBenchmarking 10.211.55.25 (be patient)\nCompleted 1000 requests\nCompleted 2000 requests\nCompleted 3000 requests\nCompleted 4000 requests\nCompleted 5000 requests\nCompleted 6000 requests\nCompleted 7000 requests\nCompleted 8000 requests\nCompleted 9000 requests\nCompleted 10000 requests\nFinished 10000 requests\n\n\nServer Software: nginx/1.15.8\nServer Hostname: 10.211.55.25\nServer Port: 80\n\nDocument Path: /\nDocument Length: 12 bytes\n\nConcurrency Level: 500\nTime taken for tests: 15.113 seconds\nComplete requests: 10000\nFailed requests: 0\nTotal transferred: 1690000 bytes\nHTML transferred: 120000 bytes\nRequests per second: 661.67 [#/sec] (mean)\nTime per request: 755.662 [ms] (mean)\nTime per request: 1.511 [ms] (mean, across all concurrent requests)\nTransfer rate: 109.20 [Kbytes/sec] received\n\nConnection Times (ms)\n min mean[+/-sd] median max\nConnect: 0 1 3.0 0 21\nProcessing: 13 407 1826.5 57 15085\nWaiting: 13 407 1826.5 57 15085\nTotal: 30 408 1827.8 57 15091\n\nPercentage of the requests served within a certain time (ms)\n 50% 57\n 66% 62\n 75% 81\n 80% 91\n 90% 120\n 95% 1063\n 98% 7065\n 99% 15056\n 100% 15091 (longest request)\n```\n\n#### Nginx + viola(viola start one process) + bottle\n\n```\n$ ab -n 10000 -c 500 http://10.211.55.25/\nThis is ApacheBench, Version 2.3 <$Revision: 1528965 $>\nCopyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\nLicensed to The Apache Software Foundation, http://www.apache.org/\n\nBenchmarking 10.211.55.25 (be patient)\nCompleted 1000 requests\nCompleted 2000 requests\nCompleted 3000 requests\nCompleted 4000 requests\nCompleted 5000 requests\nCompleted 6000 requests\nCompleted 7000 requests\nCompleted 8000 requests\nCompleted 9000 requests\nCompleted 10000 requests\nFinished 10000 requests\n\n\nServer Software: nginx/1.15.8\nServer Hostname: 10.211.55.25\nServer Port: 80\n\nDocument Path: /\nDocument Length: 12 bytes\n\nConcurrency Level: 500\nTime taken for tests: 3.090 seconds\nComplete requests: 10000\nFailed requests: 0\nTotal transferred: 1290000 bytes\nHTML transferred: 120000 bytes\nRequests per second: 3236.64 [#/sec] (mean)\nTime per request: 154.481 [ms] (mean)\nTime per request: 0.309 [ms] (mean, across all concurrent requests)\nTransfer rate: 407.74 [Kbytes/sec] received\n\nConnection Times (ms)\n min mean[+/-sd] median max\nConnect: 0 1 3.0 0 22\nProcessing: 1 133 532.0 23 3042\nWaiting: 1 133 532.0 23 3042\nTotal: 9 134 533.3 24 3053\n\nPercentage of the requests served within a certain time (ms)\n 50% 24\n 66% 28\n 75% 35\n 80% 39\n 90% 50\n 95% 67\n 98% 3016\n 99% 3037\n 100% 3053 (longest request)\n```\n\n## TODO\n\n+ [ ] Improved WSGI protocol of server side\n+ [ ] Millisecond timer\n+ [ ] HTTP POST method and more\n+ [ ] Improved response module\n+ [ ] Event driven for more platforms\n+ [ ] Improved coverage\n\n## Reference\n\n- [EPOLL(7)](http://man7.org/linux/man-pages/man7/epoll.7.html)\n- [How To Use Linux epoll with Python](http://scotdoyle.com/python-epoll-howto.html)\n- [Python Standard Library](https://docs.python.org/3/library/index.html)\n- [An overview of HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview)\n- [RFC 2616 -- HTTP GET method](https://tools.ietf.org/html/rfc2616#section-9.3)\n- [PEP 333](https://www.python.org/dev/peps/pep-0333/#environ-variables)\n- [Tornado](https://www.tornadoweb.org/en/stable/#)\n- [Gunicorn](http://docs.gunicorn.org/en/latest/index.html)\n\n## License\n\nviola is released under the MIT License. See [LICENSE](https://github.com/prprprus/viola/blob/master/LICENSE) for more information.\n\n## Contributing\n\nThank you for your interest in contribution of viola, your help and contribution is very valuable. \n\nYou can submit issue and pull requests, please submit an issue before submitting pull requests ^_^.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/prprprus/viola", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "viola", "package_url": "https://pypi.org/project/viola/", "platform": "", "project_url": "https://pypi.org/project/viola/", "project_urls": { "Homepage": "https://github.com/prprprus/viola" }, "release_url": "https://pypi.org/project/viola/0.3.8/", "requires_dist": null, "requires_python": "", "summary": "viola is a lightweight and efficient WSGI server.", "version": "0.3.8" }, "last_serial": 4837827, "releases": { "0.3.5": [ { "comment_text": "", "digests": { "md5": "e976066bcf0ba801b40f265caae54f80", "sha256": "d9d3a9e582f471496344a07861ddbe6e3c117629a231f178cf835b2e2475af33" }, "downloads": -1, "filename": "viola-0.3.5-py3-none-any.whl", "has_sig": false, "md5_digest": "e976066bcf0ba801b40f265caae54f80", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14027, "upload_time": "2019-02-13T03:24:34", "url": "https://files.pythonhosted.org/packages/ca/98/b8b606f91482e7a599eac9b615beb4698c3a2e691896df8135b13dc23bcc/viola-0.3.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bfac0ccf74c5f382a5ecd4ccf4bd9130", "sha256": "c20fc8cdaa6e98738eb006396a82e966552d77971394c192b92371d507dc1d4a" }, "downloads": -1, "filename": "viola-0.3.5.tar.gz", "has_sig": false, "md5_digest": "bfac0ccf74c5f382a5ecd4ccf4bd9130", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12092, "upload_time": "2019-02-13T03:24:37", "url": "https://files.pythonhosted.org/packages/a7/08/31a26143a4450f3bb96f662f61c71cd50174b6ebcafde46964972f12e694/viola-0.3.5.tar.gz" } ], "0.3.6": [ { "comment_text": "", "digests": { "md5": "27b8458555097de36a85dab34774fdf5", "sha256": "4a3f114ef4e32bf50a2246fcb06f7e348a7ee38069ebdabd9035ca4155b6b45d" }, "downloads": -1, "filename": "viola-0.3.6-py3-none-any.whl", "has_sig": false, "md5_digest": "27b8458555097de36a85dab34774fdf5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14085, "upload_time": "2019-02-13T03:32:06", "url": "https://files.pythonhosted.org/packages/37/40/ef6e82abc5d96de9f187afaf680d5f1d73bdf0895b4e6659b8a694ad4c84/viola-0.3.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dc89c65372c1b2b6c2d9ee74499a3cbe", "sha256": "9040df13622fc558077d5e822125e542c4d56f028d5fa7b764fde4ad3e8f050d" }, "downloads": -1, "filename": "viola-0.3.6.tar.gz", "has_sig": false, "md5_digest": "dc89c65372c1b2b6c2d9ee74499a3cbe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12198, "upload_time": "2019-02-13T03:32:07", "url": "https://files.pythonhosted.org/packages/3c/12/76d9309b9fad7c2ea6bbd6bfa0f0062d709f5ed211c70e77385a7aed9bdb/viola-0.3.6.tar.gz" } ], "0.3.7": [ { "comment_text": "", "digests": { "md5": "0564e87551d48853115373de927a159b", "sha256": "08dbc085e6ca44c88faf64a86fafade4e4743a5fdc06b475f483a2768d3125eb" }, "downloads": -1, "filename": "viola-0.3.7-py3-none-any.whl", "has_sig": false, "md5_digest": "0564e87551d48853115373de927a159b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14210, "upload_time": "2019-02-13T05:43:53", "url": "https://files.pythonhosted.org/packages/43/c1/01fe70cd5cac9f7232ebb84ed284bca2012272bcdc55dec6918fd30c7a40/viola-0.3.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "872b8c6d5c76013e28ce04135ff60da3", "sha256": "95749e9388042185fc9bd54ea6308fc4bcadd3596eb0244533f5da526c307f25" }, "downloads": -1, "filename": "viola-0.3.7.tar.gz", "has_sig": false, "md5_digest": "872b8c6d5c76013e28ce04135ff60da3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12445, "upload_time": "2019-02-13T05:43:54", "url": "https://files.pythonhosted.org/packages/8f/7a/fcd7fbe2e61ab279afb705e8f085ca2412a26fb4a42fbe6631f1df7c5ced/viola-0.3.7.tar.gz" } ], "0.3.8": [ { "comment_text": "", "digests": { "md5": "6eb9b99933c607d45913b047e0a611de", "sha256": "6875b1ded7433871979bf2b691a98fa039c8910a7ae75b239515087bbc0c8bd1" }, "downloads": -1, "filename": "viola-0.3.8-py3-none-any.whl", "has_sig": false, "md5_digest": "6eb9b99933c607d45913b047e0a611de", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14216, "upload_time": "2019-02-19T02:49:16", "url": "https://files.pythonhosted.org/packages/76/13/62a5785eddb80789c7057f82f2a5af569b230e37f81dbb7a794aa887a74a/viola-0.3.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4b96c888155db5d018a00da030f82af2", "sha256": "2240273dbbbaf729cf868be81834bcee9df6ef11570c39eb30a25c20c9f16c3f" }, "downloads": -1, "filename": "viola-0.3.8.tar.gz", "has_sig": false, "md5_digest": "4b96c888155db5d018a00da030f82af2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12459, "upload_time": "2019-02-19T02:49:18", "url": "https://files.pythonhosted.org/packages/ce/c6/e4f19e78117358924a1b63478b67515d9e6db6e3d6fa7a7fb936a9dd16a4/viola-0.3.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6eb9b99933c607d45913b047e0a611de", "sha256": "6875b1ded7433871979bf2b691a98fa039c8910a7ae75b239515087bbc0c8bd1" }, "downloads": -1, "filename": "viola-0.3.8-py3-none-any.whl", "has_sig": false, "md5_digest": "6eb9b99933c607d45913b047e0a611de", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14216, "upload_time": "2019-02-19T02:49:16", "url": "https://files.pythonhosted.org/packages/76/13/62a5785eddb80789c7057f82f2a5af569b230e37f81dbb7a794aa887a74a/viola-0.3.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4b96c888155db5d018a00da030f82af2", "sha256": "2240273dbbbaf729cf868be81834bcee9df6ef11570c39eb30a25c20c9f16c3f" }, "downloads": -1, "filename": "viola-0.3.8.tar.gz", "has_sig": false, "md5_digest": "4b96c888155db5d018a00da030f82af2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12459, "upload_time": "2019-02-19T02:49:18", "url": "https://files.pythonhosted.org/packages/ce/c6/e4f19e78117358924a1b63478b67515d9e6db6e3d6fa7a7fb936a9dd16a4/viola-0.3.8.tar.gz" } ] }