Comments (5)
If you open a lot of connections, it is indeed possible to blow past the limit. If you want this level of scalability, then yes, you need to do so with ulimit. And that is the correct way to do this on UNIX/Linux systems.
However, it's quite likely that if you're not using legacy notification mechanisms (i.e. you use AIO for example), then NNG may wind up using quite a few less open files than ZMQ. ZMQ needs to open a two additional files for each socket (not connection), to provide for notification of events. NNG has to do this if you use the polling file descriptor method (which might needed e.g. with some language plugins), but if you use the more efficient AIO mechanism then it doesn't do this.
No matter how you cut it, you will have (in both ZMQ and NNG) one open file descriptor per active TCP connection. That's unavoidable, as it's how these connections work on POSIX (and even Windows) systems.
from nng.
Closing as this is just a question, which I've answered.
from nng.
Thanks for your answer. In my program (14 NIC interfaces, 2 pub-sub sockets, 16 threads), zmq opens 200+ file descriptors whenever there is a sub socket connected. nng will this happen?
from nng.
That sounds super excessive.
The issue isn't the number of NIC interfaces, but how many instances of your client you run. Each time a new client connection is established, that will be an FD (actually 2, one for the client and one for the server).
I suspect that if you're seeing this behavior even with ZMQ that there is a logic bug in your code somewhere. NNG will definitely not do that, unless you are constantly redialing. (And you shouldn't do that) -- call NNG dial just once (per client), and then keep using the same socket for all your needs. :-)
from nng.
Yes, I don't know exactly how zeromq works. but
- Change the listening port from "tcp://0.0.0.0:xxx" to "tcp://127.0.0.1:xxx"
- Reduce the number of threads in zmq context
This improved my program significantly.
I don't intend to talk too much about zmq under nng. Also please understand.
Thank you very much for your answer :)
from nng.
Related Issues (20)
- IPC socket could support setting ownership HOT 1
- Missing Header in posix_rand_getrandom.c
- nng_msg_insert: munmap_chunk(): invalid pointer HOT 3
- Deadlock during nng_close() - multi platform HOT 23
- Sendmsg Thread Blocking HOT 3
- How to create a new language binding using a binary/dll? HOT 1
- Compiler warnings / errors from new logging feature on Windows HOT 2
- Windows a deadlock on `nng_close()` HOT 13
- mqttv5_client chokes on CONNACK packet HOT 2
- setting NNG_OPT_TLS_CONFIG on socket should hold reference HOT 6
- Memory Leak in nng_rep0_open HOT 2
- IPC - Use After Free HOT 4
- Will the NNG framework built-in handle packet splitting and sticking issues during streaming transmission? HOT 2
- Tools or API could obtain all communication endpoint information for establishing communication with this machine HOT 2
- nng_socket_set_ms didn't work HOT 2
- How to build nng_testing as a dynamic library? HOT 2
- Add support for TLS PSK
- merge wolfSSL support inline, and relicense it under same terms as NNG and add PSK HOT 1
- Document - Wrong description HOT 1
- add TLS 1.3 support for Mbed TLS
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 nng.