{"id":20592926,"url":"https://github.com/lujeni/surcharge","last_synced_at":"2025-04-14T22:55:57.813Z","repository":{"id":7354386,"uuid":"8678720","full_name":"Lujeni/Surcharge","owner":"Lujeni","description":"Tool for benchmarking your web server like apache benchmark","archived":false,"fork":false,"pushed_at":"2019-10-02T22:22:59.000Z","size":68,"stargazers_count":8,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T22:55:50.919Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lujeni.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-10T01:01:13.000Z","updated_at":"2019-11-07T09:59:59.000Z","dependencies_parsed_at":"2022-09-16T17:40:43.448Z","dependency_job_id":null,"html_url":"https://github.com/Lujeni/Surcharge","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lujeni%2FSurcharge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lujeni%2FSurcharge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lujeni%2FSurcharge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lujeni%2FSurcharge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lujeni","download_url":"https://codeload.github.com/Lujeni/Surcharge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975330,"owners_count":21192208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T07:46:52.584Z","updated_at":"2025-04-14T22:55:57.787Z","avatar_url":"https://github.com/Lujeni.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=========\nSurcharge\n=========\n.. image:: https://img.shields.io/pypi/dm/surcharge.svg\n    :target: https://pypi.python.org/pypi/surcharge/\n    :alt: Downloads\n\n.. image:: https://img.shields.io/pypi/v/surcharge.svg\n    :target: https://pypi.python.org/pypi/surcharge/\n    :alt: Latest Version\n    \nIssues\n======\n- ProgressBar issues\n- DNS resolution is wrong\n\nIntroduction\n============\n**Surcharge** is a tool for benchmarking your web server like **apache benchmark**.\nSurcharge uses the **gevent** networking library. Using the **greenlets** allow to spawn many concurrent requests with little memory.\nHTTP requests are made with **requests** library.\n\n\nRequirements\n============\nThis code has been run on Python 2.7\n::\n\n  # install by the setup\n  greenlet==0.4.0\n  gevent==0.13.6\n  requests==1.2.3\n  progressbar==2.3\n\nInstallation\n============\n::\n\n  $ pip install surcharge #and enjoy\n\nTests\n=====\n\nExample command\n===============\n::\n\n\n  # simple call\n  $ surcharge http://google.com --numbers 10 --concurrency 5\n\n  # standard stdout\n  Server: gws\n\n  URL: http://173.194.67.138:80\n\n  Concurrency level: 5\n\n  Options: {'cookies': {}, 'timeout': 2.0}\n\n\n  100% |############################|\n\n\n  Number process requests: 10\n  Time taken for tests: 0.57\n  Complete requests: 10\n  Failed requests: 0\n  Faster request: 0.045\n  Slower request: 0.059\n  Time per request (only success): 0.051\n  Request per second: 98.57\n\n  # call with multiple cookies\n  $ surcharge http://httpbin.org/cookies --cookies \"{'ck':1, 'cook':value}\"\n\n  # call with HTTP Basic Auth\n  $ surcharge https://secure.test.com --auth \"user:password\"\n\n  # bench during 10 seconds\n  $ surcharge http://google.com --concurrency 10 --duration 10\n\n\nExample API\n===========\n::\n\n\n  # see the constructor or the surcharge/cli.py for more details\n  \u003e\u003e\u003e from surcharge.core import Surcharger\n  \u003e\u003e\u003e surcharge = Surcharger(url='http://google.com')\n  \u003e\u003e\u003e surcharge()\n\n  \u003e\u003e\u003e surcharge.result\n  defaultdict(\u003ctype 'list'\u003e, {200: [0.06690406799316406]})\n\n  # compute simple stat\n  \u003e\u003e\u003e from surcharge.core import SurchargerStats\n  \u003e\u003e\u003e surcharge_stats = SurchargerStats(surcharge)\n  \u003e\u003e\u003e surcharge_stats()\n\n  \u003e\u003e\u003e surcharge_stats.stats\n  {'RPS': 14.20353538774128,\n 'exec_time': 0.07088184356689453,\n 'max': 0.0704050064086914,\n 'min': 0.0704050064086914,\n 'moy': 0.0704050064086914,\n 'requests_process': 0.0704050064086914,\n 'total': 1,\n 'total_failed': 0,\n 'total_success': 1}\n\n  # By default, stdout is used to display the stats\n  # You can override the SurchargerStats.send method and make what you want with the stats\n\n  # example with a *request\" option (auth)\n  \u003e\u003e\u003e surcharge = Surcharger(url='http://google.com', **{'auth': ('user', 'pass')})\n\n\nUsage\n=====\n::\n\n\n  Usage:\n      surcharge \u003curl\u003e\n          [--method=\u003cmethod\u003e]\n          [--concurrency=\u003cclients\u003e]\n          [--numbers=\u003crequests\u003e | --duration=\u003cseconds\u003e]\n          [--timeout=\u003cseconds\u003e]\n          [--cookies=\u003ccookies\u003e]\n\n  Options:\n      -h --help                           Show this screen.\n      -v --version                        Show version.\n      -m --method=\u003cmethod\u003e                HTTP method [default: GET].\n      -c --concurrency=\u003cclients\u003e          Number of multiple requests to perform at a time [default: 1].\n      -n --numbers=\u003crequests\u003e             Number of requests to perform for the benchmarking session [default: 1].\n      -D --duration=\u003cseconds\u003e             Duration in seconds. Override the --numbers option [default: 0]\n      -T --timeout=\u003cseconds\u003e              You can tell requests to stop waiting for a response after a given number of seconds [default: 2].\n      -C --cookies=\u003ccookies\u003e              Send your own cookies. [default: {}]\n\nLogs\n====\nYou can retrieve some informations in the */tmp/surcharge_activity.log* log file.\n\nDeprecated - need refactoring\n=============================\n (`since 0.8`) **Overflow** is a module of Surcharge. It's allows to launch several benchmarks dynamically through the network. Overflow uses the **zeroMQ** library.\n\nLicense\n=======\nThis project is lecensed under the MIT license, a copy of which can be found in the LICENSE file.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flujeni%2Fsurcharge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flujeni%2Fsurcharge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flujeni%2Fsurcharge/lists"}