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:
-
Axios: “Promise based HTTP client for the browser and node.js”.
-
Node-fetch: “A light-weight module that brings Fetch API to Node.js”.
-
Superagent: “light-weight progressive ajax API crafted for flexibility, readability, and a low learning curve…”
- Plain Http: built-in Nodejs package to handle HTTP communication.
Http Servers:
-
FastAPI: “a high performance framework, easy to learn, fast to code, ready for production…”
-
Flask: it doesn’t need introduction, does it? This web framework is widely used to build Python backend.
-
Pyramid: “small, fast, down-to-earth Python web framework…”
-
Tornado: “Python web framework and asynchronous networking library…”
WebSocket Clients:
-
Websocket-Node: “pure JavaScript implementation of the WebSocket protocol versions 8 and 13 for Node”. I’m using here the client version.
-
WS: “simple to use, blazing fast, and thoroughly tested WebSocket client and server implementation.”
WebSocket Servers:
-
Eventlet: “concurrent networking library for Python that allows you to change how you run your code, not how you write it…”
-
FastAPI WebSockets: Http server FastAPI providing with WebSocket protocol.
-
Tornado WebSockets: Http server Tornado providing with WebSocket protocol.
-
WebSockets python package: “a library for building WebSocket servers and clients in Python with a focus on correctness and simplicity.”
Socket.IO Client:
-
Socket.IO-client: official Javascript implementation.
Socket.IO Servers:
-
Flask-Socket.IO: “gives Flask applications access to low latency bi-directional communications between the clients and the server…”
-
Python-Socket.IO: “enables real-time bidirectional event-based communication between clients (typically, though not always, web browsers) and a server.”