vadrsa / SimpleR

High Performance Pure WebSocket Server Library based on SignalR
MIT License
17 stars 3 forks source link

Performance metrics #17

Open Montrichard opened 1 month ago

Montrichard commented 1 month ago

Hi!

I've just found your library and this looks great from what I've seen - nice work!

I'm looking to write an OCPP server and started writing my own websocket handler boiler plate code with ASP.NET but really didn't like it and this library looks like it handles a lot more out of the box.

I was just wondering if you have ever run any benchmarks against it for performance and memory leaks/CPU metrics etc?

Out of interest are you using this library for OCPP too or something else?

I'm looking forward to getting stuck into this library! 👍

vadrsa commented 1 month ago

Hi @Montrichard

There are currently no performance benchmarks set up for this library.

Before becoming SimpleR, earlier versions of this code have been used to run OCPP websocket servers and went through some level of refinement and bug fixes. But as a library, my plan is to refine it through user feedback. And at some point, when I know of some number of successful usages, I will move the library to a stable major version.

Having said that, I have some plans to set up Autobahn testing this year. If you have some specific priorities in terms of benchmarking and are willing to give SimpleR a go, please let me know and I will try to make it happen. And of course, any contribution will be appreciated.

Montrichard commented 1 month ago

Hi!

Sounds good!

I will give this library a go and see how we get on. We have potentially thousands of chargers connecting to this so we'll need to know if mem/cpu usage is ok along with TLS termination and container blue/green deployments and how websockets cope with that, lots to investigate 😄

vadrsa commented 1 month ago

Sounds good! Feel free to open issues for anything you need help with.

Montrichard commented 4 weeks ago

Can you recommend a decent simulator. I've looked at Monta's OCPP simulator and https://github.com/victormunoz/OCPP-1.6-Chargebox-Simulator/tree/master but neither seem to be great.

For example, clicking the Connect button in the latter example when it hits the server there is no Upgrade header specified https://github.com/vadrsa/SimpleR/blob/945bc40b8c6a3fc37b20af7e4f33692493c17ccc/examples/SimpleOcpp.Server/OcppAuthenticationHandler.cs#L17-L17

vadrsa commented 4 weeks ago

I have used the simulator you mention and it should work just fine at least for simple scenarios.

Not all requests will have an upgrade header, but since the simulator code is opening a standard WebSocket in js, you should be seeing at least one upgrade request.

Montrichard commented 4 weeks ago

Not that I can see but maybe that's happening deeper inside ASP.NET/SimpleR. I just put a breakpoint on the OcppAithenticationHandler to get going with that simulator but it always sends a CONNECT request with no Upgrade header

Montrichard commented 4 weeks ago

I think that code needs if Request.Protocol != "HTTP/2" && Request.Headers.Upgrade != "websocket"

vadrsa commented 4 weeks ago

@Montrichard Not sure why you would need if Request.Protocol != "HTTP/2" && Request.Headers.Upgrade != "websocket".

I tested the example ocpp server with the simulator, the upgrade header is being sent, but the Basic authorization header is not set from the simulator. If I remember correctly, there is no way to set ANY header from a browser WebSocket.

What you can do is create a pass through auth logic that will be active only in Development environment and for preventing accidental mistakes allow it only for some fake charger id.