1. Home
  2. Docs
  3. Documentation
  4. Performance guidelines

Performance guidelines

In order to achieve optimal performance, there are a few rules you should follow (these are mostly about the server):

  • Use FireAndForget – most methods do not need to wait for the execution on the server to complete before moving on. By using FireAndForget, the message will still be delivered (if you are not disconnected, but that raises another issue altogether)
  • Make the methods fast – try not to do any database calls in a regular methods. You can instead run a background thread, and the plugin method the client invokes just needs to add to some queue which will be processed
  • Use async/await and tasks on blocking calls – in case you must access the file system, etc, use Tasks. You should not however use tasks just because you want to invoke the method on the client earlier, and than await the response sometimes later. Tasks do have additional overhead, and invoking many of them on the server will impact the performance
  • Read books about high performance code – One recommendation is “Writing High Performance .NET Code”, which can be found here: https://www.writinghighperf.net/
Was this article helpful to you? Yes No

How can we help?