Giter Club home page Giter Club logo

Comments (5)

gonzaloserrano avatar gonzaloserrano commented on August 24, 2024 1

How many KB per connection do you think is light enough? I think 10KB is amazing for a Go program where a launching a goroutine is between 4-8KB itself.

from ws.

gobwas avatar gobwas commented on August 24, 2024 1

Hi @ohenepee, hi @gonzaloserrano =)
Actually, 10KB is not the limit – currently application that is being discussed in the article on medium takes 8KB per connection (with GC_PERCENT set to 75%). But, if your connection does not alive – that is, does not write any data to you and you do not write data to it, then memory allocation could appear only for storing net.Conn if you use some low-level optimizations with linux epoll (see easygo/netpoll).

Thus, it much depends on use cases and behaviour patterns of your connections. For example, if some read event occur on connection, which size of the read buffer you will use? So it also makes differences on memory consumption.

Cheers !👍
Sergey.

from ws.

gonzaloserrano avatar gonzaloserrano commented on August 24, 2024

Hi, did you read https://medium.freecodecamp.org/million-websockets-and-go-cc58418460bb?

from ws.

ohenepee avatar ohenepee commented on August 24, 2024

10kB per connection amounts to 10GB for 1 million connections... if my calculations are correct, that's not so light tho

from ws.

ohenepee avatar ohenepee commented on August 24, 2024

Yes your statement is very true, when compared to the goroutine allocation.

from ws.

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.