Comments (10)
Have you tried to disable Nagle algorithm by setting tcp_nodelay to true?
https://crystal-lang.org/api/0.18.7/TCPSocket.html#tcp_nodelay%3F-instance-method
from bojack.
Other programming languages have this very same problem due to how Nagle works. If it works, we should think about it. Here is a nice reading about the topic: https://www.extrahop.com/community/blog/2009/to-nagle-or-not-to-nagle-that-is-the-question/
from bojack.
My results:
➜ bojack git:(master) ✗ crystal run --release benchmarks/socket_nagle.cr
user system total real
shared 0.000000 0.000000 0.000000 ( 0.007952)
new 0.000000 0.010000 0.010000 ( 0.015957)
from bojack.
@mauricioabreu / @hugoabonizio I was doing the same thing last night, but I was trying to measure how long it would take to have like 100_000 or 1_000_000 keys in the database. The thing is we have some consistency/concurrency issues on handling several requests.
I had to test this with ruby, because I wasn't able to create many parallel tcp requests with Crystal for some reason.
Take a look at the benchmarks
branch.
from bojack.
Interesting! I didn't know about Nagle's algorithm yet. Disabling for both client and server the performance was much better. It seems like Redis disables this by default, should we do the same?
from bojack.
@hugoabonizio I don't know. I suck at TCP but it is worth a try. :)
@marceloboeira what is this "consistency/concurrency" problem exactly?
from bojack.
@hugoabonizio gonna have a look on this, but if it increases performance and redis is doing it, probably we should!
from bojack.
@mauricioabreu it seems that we are not correctly implementing the "secure" routine for the TCP connection/request handler.
Please read #19 for a complete answer!
from bojack.
@hugoabonizio will you handle the Nagle's thing? cause I would like to try solving the concurrency problems yet it will take me a while.
from bojack.
@marceloboeira OK!
from bojack.
Related Issues (20)
- Client always connect with 127.0.0.1:5000
- [Logger] Set log level (severity)
- [CLI] Hostname / Help conflict flag HOT 3
- [CLI] Handle Connection refused HOT 1
- [Server] Unhandled exception (Missing key)
- [Documentation] Add CLI usage detailed information
- [Security] Use SSL
- BoJack client shard HOT 8
- Next step: a GUI? HOT 3
- Add TTL to keys HOT 2
- Increment isn't thread-safe HOT 3
- [Refactor] Singleton Logger
- [Bug] File `logo` not found HOT 1
- Add support for Unix sockets
- Handle Exceptions level (Runtime, Fatal) HOT 1
- Request timeouts HOT 4
- [Build Error] console.cr HOT 8
- RESP support HOT 2
- Unhandled "Connection reset by peer" in runtime HOT 1
- Format logs more atomically
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 bojack.