Open levb opened 1 month ago
@kozlovic ACK that it is way too early to review, and I am focused on other things for the time being anyway. I marked you to get your "FYI"-level attention, feel free to un-assign if this is too noisy.
...each publish ended-up result in the tcp write
the plan was to optimize it to use writev
, like in https://github.com/nginx/nginx/blob/e734df6664e70f118ca3140bcef6d4f1750fa8fa/src/os/unix/ngx_writev_chain.c#L14 but I didn't get to prototype it. So everything would still be buffered (into a chain), and then segments written out of the chain, 1 iovec at a time per write event. I just didn't get to the sockets at all, figured I'd wrap it on top of the existing code for now. Ditto establishing connections - that too would need to be event driven for re-connections.
PR for discussion only, not to be merged.
natsSock_ConnectTcp
to connectwrite
s are not optimized at all, yet. Turn onDEV_MODE_CONN_TRACE
to see the trace.Example: https://github.com/nats-io/nats.c/blob/mininats/examples/libevent-pub.c It connects and sends 5 messages to a server. The entire heap usage is logged (there are still leaks, please ignore, cleanup is not fully implemented).
To see more details, turn on more logging here
server log: