{"id":16732580,"url":"https://github.com/antonmi/node_vs_eventmachine","last_synced_at":"2025-03-15T19:44:13.197Z","repository":{"id":8860397,"uuid":"10571038","full_name":"antonmi/node_vs_eventmachine","owner":"antonmi","description":"Comparison of http servers and frameworks based on Node.js and EventMachine","archived":false,"fork":false,"pushed_at":"2013-07-04T08:36:23.000Z","size":436,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-22T08:47:19.109Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antonmi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-08T16:24:34.000Z","updated_at":"2013-10-10T11:58:43.000Z","dependencies_parsed_at":"2022-08-27T21:10:55.346Z","dependency_job_id":null,"html_url":"https://github.com/antonmi/node_vs_eventmachine","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonmi%2Fnode_vs_eventmachine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonmi%2Fnode_vs_eventmachine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonmi%2Fnode_vs_eventmachine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonmi%2Fnode_vs_eventmachine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonmi","download_url":"https://codeload.github.com/antonmi/node_vs_eventmachine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243784099,"owners_count":20347409,"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-10-12T23:45:41.964Z","updated_at":"2025-03-15T19:44:13.164Z","avatar_url":"https://github.com/antonmi.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"##Comparison of http servers and simple frameworks based on Node.js and EventMachine\n\n### Be careful - synthetic tests!\n\n## Total results:\n\n```\n==============================================\n=  Application         |        krps         =\n=--------------------------------------------=\n=  evma_httpserver     |        14.7         =\n=--------------------------------------------=\n=  Node.js http server |        7.9          =\n=--------------------------------------------=\n=  Thin server         |        7.7          =\n=--------------------------------------------=\n=  Sinatra app         |        2.9          =\n=--------------------------------------------=\n=  AsyncSinatra app    |        3.3          =\n=--------------------------------------------=\n=  Express.js app      |        5.2          =\n==============================================\n\n```\n## evma_httpserver\n\n### Application\nThe [application](https://github.com/antonmi/node_vs_eventmachine/blob/master/evma_httpserver/evma_httpserver.rb):\n\n``` ruby\nrequire 'eventmachine'\nrequire 'evma_httpserver'\n\nclass TestServer \u003c EM::Connection\n  include EM::HttpServer\n\n  def post_init\n    super\n    no_environment_strings\n  end\n\n  def process_http_request\n    response = EM::DelegatedHttpResponse.new(self)\n    response.status = 200\n    response.content_type 'text/html'\n    response.content = 'Hello World'\n    response.send_response\n  end\nend\n\nEM.run{\n  EM.start_server '127.0.0.1', 5000, TestServer\n}\n```\n\n### Results\n\n`Requests per second:    14710.01 [#/sec] (mean)`\n\nSee details [here](https://github.com/antonmi/node_vs_eventmachine/tree/master/evma_httpserver).\n\n\n## Node.js http server\n### Application\nThe [application](https://github.com/antonmi/node_vs_eventmachine/blob/master/node/node.js):\n\n``` javascript\nvar http = require('http');\n\nvar server = http.createServer(function (request, response) {\n    response.writeHead(200, {\"Content-Type\": \"text/html\"});\n    response.end(\"Hello World\");\n});\n\nserver.listen(6000);\n```\n\n### Results\n\n`Requests per second:    7869.49 [#/sec] (mean)`\n\nSee details [here](https://github.com/antonmi/node_vs_eventmachine/tree/master/node).\n\n## Thin server. Simple Rack application\n### Application\nThe [application](https://github.com/antonmi/node_vs_eventmachine/blob/master/thin/config.ru):\n\n``` ruby\nclass App\n  def call(env)\n    [200, {'Content-Type' =\u003e 'text/html'}, 'Hello world']\n  end\nend\n\nrun App.new\n\n\n#thin -R config.ru start -p5001\n```\n\n### Results\n\n`Requests per second:    7667.10 [#/sec] (mean)`\n\nSee details [here](https://github.com/antonmi/node_vs_eventmachine/tree/master/node).\n\nWith `--threaded` option:\n\n`Requests per second:    2166.96 [#/sec] (mean)`\n\n## Sinatra application.\n### Application\nThe [application](https://github.com/antonmi/node_vs_eventmachine/blob/master/sinatra/app.rb):\n\n``` ruby\nrequire 'sinatra'\n\nset :server, :thin\nset :host, '127.0.0.1'\nset :port, 5002\nset :logging, false\nset :threaded, false #this option set to true by default\nset :environment, 'production'\n\nget '/' do\n  \"Hello world\"\nend\n```\n\n### Results\n\n`Requests per second:    2895.68 [#/sec] (mean))`\n\nWith `set :threaded, true`:\n\n`Requests per second:    977.92 [#/sec] (mean)`\n\nSee details [here](https://github.com/antonmi/node_vs_eventmachine/tree/master/sinatra).\n\n## AsyncSinatra application.\n### Application\nThe [application](https://github.com/antonmi/node_vs_eventmachine/blob/master/async_sinatra/app.rb):\n\n``` ruby\nrequire 'sinatra/async'\n\nclass AsyncTest \u003c Sinatra::Base\n  register Sinatra::Async\n\n  set :threaded, false\n  set :server, :thin\n  set :host, '127.0.0.1'\n  set :port, 5003\n\n  aget '/' do\n    body('Hello world')\n  end\n\n  run!\nend\n```\n\n### Results\n\n`Requests per second:    3285.19 [#/sec] (mean)`\n\nSee details [here](https://github.com/antonmi/node_vs_eventmachine/tree/master/async_sinatra).\n\n\n## Express.js application.\n### Application\nThe [application](https://github.com/antonmi/node_vs_eventmachine/blob/master/express_js/app.js):\n\n``` javascript\nvar express = require('express');\nvar app = express();\napp.get('/', function(req, res){\n    res.send('Hello World')\n});\n\napp.listen(6001);\n```\n\n### Results\n\n`Requests per second:    5222.03 [#/sec] (mean)`\n\nSee details [here](https://github.com/antonmi/node_vs_eventmachine/tree/master/express_js).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonmi%2Fnode_vs_eventmachine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonmi%2Fnode_vs_eventmachine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonmi%2Fnode_vs_eventmachine/lists"}