tomcucinotta / distwalk

Distributed processing emulation tool
GNU General Public License v3.0
2 stars 4 forks source link

check how to reuse cached sockets in socks[] #17

Closed tomcucinotta closed 12 months ago

tomcucinotta commented 1 year ago

If I have a client asking its server node s to forward the request to a node n, and then another client asking the same server node s to forward the request to the same node n, then we'd try to reuse the socket already established between s and n, for the second client request. However, as n will reply onto the same socket, when the result comes back from the socket, we need to differentiate which client the answer is for. This is a case that cannot be handled in the current forward() code sketch, because a client sends a forward, expecting its reply back from that socket, but the reply could actually be for someone else. In the shortest term, to recover consistency, we should instantiate the socks[] cache to be per-client (thread). However, this case could be handled properly with a forward integrated properly within the epoll() machinery.

tomcucinotta commented 1 year ago

temporary remedy for one of the problems related to this issue: 7f0e9400

tomcucinotta commented 1 year ago

just sketched a few sequence diagrams to depict possible scenarios that would need to be properly handled, see commit 9254f1d, and the .puml files added in https://github.com/tomcucinotta/distwalk/tree/master/doc

tomcucinotta commented 12 months ago

this is partially addressed and at the same time obsoleted by the reqs[] array introduced in 99f041cf8, and the accompanying rework as from #19.