MDSplus / mdsplus

The MDSplus data management system
https://mdsplus.org/
Other
71 stars 43 forks source link

assign priorities to incoming mdsip connections #2790

Open vadim-at-te opened 3 months ago

vadim-at-te commented 3 months ago

Affiliation Tokamak Energy, 173 Brook Dr, Milton, Abingdon, UK

Description We experience a serious problem where, due to a relative large traffic of mdsip clients trying to connect to MDSplus server, some connections failed. The most acute problem is that systems that write (tokamak plasma pulse) experimental raw data to MDSplus frequently fail to store data. Clearly, we'd like to assign high-priority to those client ip-addresses and/or usernames that are associated with servers writing experimental data to MDSplus and low-priority to mdsip clients that simply read data for analysis.

The desired behaviour is that in the event of too many mdsip connections, the (small number of) high priority clients are always successful at connecting and writing data and (the large number of) low priority read clients may have connection attempts fail.

the file /etc/mdsip.hosts looks like a config file where it could make sense to specify such prioritization per client ip and username

I will raise a separate issue about sporadic failures to connect to MDSplus server

Example I am happy to write code as a contributor and submit it for a merge review if you point me in the right direction.

Otherwise, I don't have a pseudocode example but I have a user-experience example. I'd like to be able to assign linux process priority number or mdsplus-internal-equivalent in /etc/mdsip.hosts, like so:

* | MAP_TO_LOCAL

dt100 | te.user PRIO 10 @192.168.2.* | te.user PRIO 40

of course, it doesn't have to be in /etc/mdsip.hosts - it's the ultimate functionality that matters.

Additional context We experience problems where, during experimental campaign, several diagnostic systems fail to write raw data to MDSplus due to failure to connect to the server. Our linux admin had increased the Network Interface Card bandwidth and monitored to verify that the total number of incoming tcp connection the the physical-linux-server where MDSplus server is installed, is well within the spec. So we don't believe this to be a matter of networking hardware. Other tcp-based services appear fine. We are logging the total number of mdsip processes on the server and it hovers at around 1500.

I had asked questions on this topic on MDSplus "discord" forum: https://discord.com/channels/935565750679273482/935565751513935955/1248285737045200949

WhoBrokeTheBuild commented 1 month ago

So this is possible, however it requires a bit of a paradigm shift. In order to have connections that are "prioritized", you want to have MDSip services listening on those ports ready to go. This is how I recommend you write all data, and avoid writing data over xinetd/systemd sockets altogether, to avoid any potential issues with failures to connect and data loss. So for each diagnostic, you have an mdsip service waiting on a port, and each diagnostic is keyed into using a single mdsip service.

I know we talked about this before, but this is really the most standard mdsplus way to handle the issue.

If you want to try to give certain connections higher priority, you could make a second xinetd/systemd service that spawns connections with nice -20 on it, or something to that effect.