Comments (2)
Just want to understand why there is an impact of 4.25x in performance when the size of message is just increased by 1.4x.
It seems likely that you're hitting a 128KB socket send buffer (SO_SNDBUF). The first N bytes written to a socket will appear to be instantaneous, but once that buffer is full, no more can be sent until we've received an ACK from the other side of the connection. This can show up as time spent in epoll (but be careful, because epoll is a shared resource across all connections in the process - generally when you're profiling an async application you should ignore epoll time; it's what the server is doing when it's idle).
When binary is true the amount of time consumed in epoll is almost negligible and it doesn't seem to be having any performance difference based on the size of string as well.
This is surprising - there's almost no difference on the write path between binary and text messages - just a call to str.encode()
. Everything at the network level should be equivalent. Is everything but the binary flag the same in these tests?
from tornado.
Thanks for responding.
@bdarnell
I have shared the epoll impact particulary because, I have done profiling at that one line of code which writes data to encode and observed the impact on epoll,
await client["client"].write_message(frame_data, is_binary)
I did profliling on this very exact line.
The size change doesn't seem to affect is_binary as true and it does only when is_binary is false in the above case everything else is exactly same in the enviroment.
from tornado.
Related Issues (20)
- py3.12: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal HOT 4
- Inaccurate typing for body/query argument getters
- High CPU consumption when upgrade to tornado > 5 HOT 2
- Can I write a single decorator combining @tornado.gen.coroutine and @run_on_executor. HOT 2
- Possible leak when exception is raised in inner coroutine HOT 1
- iostream: SSL logging is too noisy
- Tornado was blocked for more than 1 second in HOT 1
- static_url with a prefix does not work in a Template tag HOT 2
- how to handle the http stream data without using callback but based on coroutine? HOT 1
- Test fail with openssl 3.2 HOT 1
- tornado.websocket.WebSocketClosedError
- Send 204 as HTTPError
- `Subprocess.wait_for_exit` never resolves if process terminated before it is called HOT 2
- Websocket Client Handshake URI issue HOT 1
- Questions about Copilot + Open Source Software Hierarchy
- tornado.httputil.HTTPServerRequest and tornado.web.RequestHandler
- Please update to 3.11 HOT 1
- TypeError: WebSocketHandler.init() missing 2 required positional arguments: 'application' and 'request'
- Under pytest 8.2.0, 'AsyncHTTPTestCase' has no attribute 'runTest' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tornado.