Forum
Please or Register to create posts and topics.

Streaming Speed

I am working with Http Server. I send a request to http://localhost:54664/samples and get the data. I think my data retrieval speed is slow because I have previously recorded data with the same data length. The format JSON is exactly the same as the data that comes to me when I send a request. When I read these files as requests come in and send them to my own program, I access the data faster.
Is there any way to increase the transfer speed?

Not quite sure what you mean with the following:

"The format JSON is exactly the same as the data that comes to me when I send a request. When I read these files as requests come in and send them to my own program, I access the data faster."

In case you're comparing the file size of records generated by the File Writer block with the data size retrieved from the HTTP server: File records are stored in a (compressed) binary format, while the default JSON output format of the HTTP server is text based and therefore usually significantly larger than binary data. Also processing text data is usually computationally more expensive than processing binary data (depends on your application though).

You can request binary data from the HTTP server by specifying the "format" query parameter. It can accept the following values:

float32 - sample data is reported as a sequence of binary 32 bit float values

float16 - sample data is reported as a sequence of binary 16 bit float values

int16 - sample data is reported as a sequence of binary 16 bit integer values

Please check the HTTP Streaming documentation for details: https://v6-forum.aaronia.de/forum/topic/rtsa-suite-pro-http-streaming/

my stream block

This is my broadcast block.

I use http://localhost:54664/sample. With this address, I downloaded the incoming data by sending a request in the web browser and saved it in txt format (about 2000 txt files). Then, with the api I wrote, I transferred these files to my program as requests came. Just like in the RTSA-Pro software. I found out that my own API is 2 times faster. For example, if my data retrieval and processing speed using my own API is 80ms on average, my data retrieval and processing speed using RTSA-Pro HTTP Server is 150ms.

My main question is, is there a way to increase this speed? Is there a setting that needs to be done and should I do something about the cables?

 

My Api Code :

My Api Code

Hi, I'm also interested on increasing the speed of the data streaming, did you manage to make it faster?

Well, you first have to figure out what your problem is. As far as the HTTP server is concerned, there is no difference between accessing the data via browser or via API.

Of course if you pre-save data to local files and then just process those independently that will obviously be faster as you're completely ignoring the network layer, but that's hardly a relevant comparison as you're no longer dealing with live data.

For performance improvements, as already mentioned above one step would be to request data in binary format instead of JSON as text data requires a lot more bandwidth (therefore more packets) and also parsing it uses more resources. Other options could be to change the measurement parameters or tweak the TCP connection settings. If you need a continous data stream you can also use the /stream endpoint instead of /sample to avoid the repeated connection setup and teardown.