Git Product home page Git Product logo

Comments (10)

mauricioabreu avatar mauricioabreu commented on May 16, 2024

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.

mauricioabreu avatar mauricioabreu commented on May 16, 2024

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.

mauricioabreu avatar mauricioabreu commented on May 16, 2024

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.

marceloboeira avatar marceloboeira commented on May 16, 2024

@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.

hugoabonizio avatar hugoabonizio commented on May 16, 2024

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.

mauricioabreu avatar mauricioabreu commented on May 16, 2024

@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.

marceloboeira avatar marceloboeira commented on May 16, 2024

@hugoabonizio gonna have a look on this, but if it increases performance and redis is doing it, probably we should!

from bojack.

marceloboeira avatar marceloboeira commented on May 16, 2024

@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.

marceloboeira avatar marceloboeira commented on May 16, 2024

@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.

hugoabonizio avatar hugoabonizio commented on May 16, 2024

@marceloboeira OK!

from bojack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.