OFFIS-DAI / mango

Modular Python-based agent framework to implement multi-agent systems
https://mango-agents.readthedocs.io/
MIT License
12 stars 2 forks source link

Pool TCP Connections #48

Closed rcschrg closed 1 year ago

rcschrg commented 1 year ago

Currently, mango always creates new connections for new messages. However, in reality, we often send messages to the same receiver within a short period. Consequently, we should implement the pooling of connections with an adjustable parameter, which defines the time connections to a host/port should stay open when unused.

rcschrg commented 1 year ago

In GitLab by @maurerle on Apr 5, 2023, 14:06

Why would one ever need to close the connection after a specified time?

The connection could stay open until one of the containers close?

I think this could be implemented straight-forward in tcp.py having a dict of open connections to other containers?

rcschrg commented 1 year ago

Well, that is what will happen in most cases (the time will obviously reset when the connection is retrieved). However, if there are a lot of containers you want to communicate with, having one (or multiple!) connections per every other container, could allocate a substantial amount of resources. Ofc, we need to be careful regarding the default parameters, the result will also contain something like max_connection_per_container and I will ofc implement an option to practically never close connections.

@maurerle In case you are interested to review the result, I won't hesitate to assign you once it is finished :)