HTTP-vs-WebSockets-performance

[Experiment] HTTP vs WebSockets performance comparison

Stars
2

HTTP vs WebSockets performance

This is an experiment to compare HTTP vs WebSockets performance using Python server <==> Nodejs client. The idea is to find the best team to later on build AI agents on top of them.

I wrote an article about it in Medium

Libraries Tested

Http Clients:

  1. Axios: “Promise based HTTP client for the browser and node.js”.
  2. Node-fetch: “A light-weight module that brings Fetch API to Node.js”.
  3. Superagent: “light-weight progressive ajax API crafted for flexibility, readability, and a low learning curve…”
  4. Plain Http: built-in Nodejs package to handle HTTP communication.

Http Servers:

  1. FastAPI: “a high performance framework, easy to learn, fast to code, ready for production…”
  2. Flask: it doesn’t need introduction, does it? This web framework is widely used to build Python backend.
  3. Pyramid: “small, fast, down-to-earth Python web framework…”
  4. Tornado: “Python web framework and asynchronous networking library…”

WebSocket Clients:

  1. Websocket-Node: “pure JavaScript implementation of the WebSocket protocol versions 8 and 13 for Node”. I’m using here the client version.
  2. WS: “simple to use, blazing fast, and thoroughly tested WebSocket client and server implementation.”

WebSocket Servers:

  1. Eventlet: “concurrent networking library for Python that allows you to change how you run your code, not how you write it…”
  2. FastAPI WebSockets: Http server FastAPI providing with WebSocket protocol.
  3. Tornado WebSockets: Http server Tornado providing with WebSocket protocol.
  4. WebSockets python package: “a library for building WebSocket servers and clients in Python with a focus on correctness and simplicity.”

Socket.IO Client:

  1. Socket.IO-client: official Javascript implementation.

Socket.IO Servers:

  1. Flask-Socket.IO: “gives Flask applications access to low latency bi-directional communications between the clients and the server…”
  2. Python-Socket.IO: “enables real-time bidirectional event-based communication between clients (typically, though not always, web browsers) and a server.”