OpenFabrics / sunfish_library_reference

The core Sunfish implementation
BSD 3-Clause "New" or "Revised" License
2 stars 4 forks source link

Asynchronous management of events #26

Open christian-pinto opened 1 month ago

christian-pinto commented 1 month ago

When the sunfish core receives an event it handles it synchronously and the event sender waits for the entire time it gets processed. Events should return immediately for the client and be processed by a thread (or similar).

christian-pinto commented 1 month ago

@mjaguil

mjaguil commented 1 month ago

I will be working on threads and thread locking

christian-pinto commented 1 month ago

While making events asynchronous we should also look into multi-threading in general.

The two places where multithreading is needed are:

  1. The REST API interface
    • Clients use the Sunfish RESTful API, with potentially multiple clients doing it in parallel. Flask restful is already supporting multi threading at the API interface level.
  2. Events handling
    • Clients/agents send an event to sunfish (POST) and are released immediately without waiting for the event to be processed.

For both the above we need to make sure that both the sunfish core library and the event interface are thread safe. This includes that the storage backends are also thread safe.

christian-pinto commented 1 month ago

A way of working towards thread safe-ness is to use a database for storing the redfish tree.

We should evaluate a couple of alternatives: