Here is a quick & dirty benchmark to measure how fast we can stuff data from the real world to a script using the LSL HTTP server. Data may come from some sensor or human interaction device, maybe motion capture, a Wii Remote, a Kinect ... and would control a simulation in real-time.

The benchmark sends requests in the form seq=n, where n is an incrementing sequence number. Any sequence gap on the receiver side will indicate a lost message. There is an important assumption : we are not interested in the reply and don't care reading it. This makes a HUGE difference.

Code :
https://github.com/jeff-kelley/opensim-utils/tree/master/lsl_http-benchmark

Let's begin with the LSL script. It allocates a url then wait for a request. GET and POST are supported. It checks the received sequence number against the expected number and complains it they mismatch. Finally, the script counts and display the number of requests it receives every second.

On the client side, I chose Perl and the Net::HTTP class. No doubt that could be written in Python, Ruby, C#, even PHP. The client opens a HTTP connection in KeepAlive, then emit requests at a steady rate. Inside the loop, the HTTP write is timed, and the wait to the next request is computed.

The variable $reqSec controls the number of request per second. Performing the test with different values gives an idea of the overall performance.

Now for the unbelievable :

[09:56] Primitive: Requests/second : 207
[09:56] Primitive: Requests/second : 198
[09:56] Primitive: Requests/second : 220
[09:56] Primitive: Requests/second : 198
[09:56] Primitive: Requests/second : 214
[09:56] Primitive: Requests/second : 206
[09:56] Primitive: Requests/second : 207
[09:56] Primitive: Requests/second : 213
[09:56] Primitive: Requests/second : 207

Between two machine on a LAN, my figure is 200. Holy cow! This is more than enough for a smooth simulation. As a bonus, you get a high-speed, high-jitter event source.

LSL HTTP server slow ?

Not !



-- Jeff
_______________________________________________
Opensim-users mailing list
[email protected]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users

Reply via email to