python-ivi / python-vxi11

Provides a VXI-11 driver for controlling instruments over Ethernet
MIT License
161 stars 71 forks source link

Keysight E5810B slows down after 10 connections #28

Open kunalq opened 6 years ago

kunalq commented 6 years ago

Each time a new TCP/IP connection is established with the Keysight E5810B, it internally spawns a process that takes 50-100% of a core's CPU power. It's possible that it's internally polling aggressively. When creating multiple Instrument objects, each with its own connection, at about 10 instruments the box slows down significantly as the CPU is at saturation.

An easy workaround would be to share the client connection between all Instruments and the InterfaceDevice.

I'd be happy to put up a PR that accepts an optional client input in the initializer; however, I'm not sure if this is the approach you would prefer. An alternative approach would be a connection pool keyed on the IP address of the host; it could then grab an existing connection rather than create a new one.