in reply to Re^3: making a loop script with a remote URL call faster
in thread making a loop script with a remote URL call faster
I just only realized that the OP mixes timed and non-timed code. This only works if jitter is not considered a major problem.
If the timing needs to be quite exact, my usual approach is to run two different process and use some form of interprocess communication. One process fetches the data from the remote server (however long that takes), parses it and then sends the relevant information to the other process that does cyclic processing.
There are many ways to do this, depending on the data size and the operating system. TCP or UDP work OK, Unix Domain Sockets are quite a bit faster though. There are also pipes and stuff.
Often it's quite a lot easier to use an existing messaging solution, though. Again, there are many solutions, depending on your requirements. Personally, i of course will shamelessly plug my own, which is Net::Clacks. There are some examples that should you get started. If not, i'm a regular here. And there is even a small (slightly out-of-date) mini-tutorial here on PM: Interprocess messaging with Net::Clacks. The Upgrade Guide inluded in more recent versions of Net::Clacks also contains quite a lot of information not documented otherwise.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: making a loop script with a remote URL call faster
by haukex (Archbishop) on Jan 18, 2022 at 13:41 UTC | |
|
Re^5: making a loop script with a remote URL call faster
by LanX (Saint) on Jan 16, 2022 at 23:43 UTC | |
by cavac (Prior) on Jan 17, 2022 at 15:47 UTC | |
by LanX (Saint) on Jan 17, 2022 at 17:17 UTC |