CARTAvis / carta-backend

Source code repository for the backend component of CARTA, a new visualization tool designed for the ALMA, the VLA and the SKA pathfinders.
https://cartavis.github.io/
GNU General Public License v3.0
22 stars 11 forks source link

Migrate to latest stable release of uWebSockets #224

Closed veggiesaurus closed 3 years ago

veggiesaurus commented 5 years ago

The latest version of uWebSockets has some performance improvements and removes the use of deprecated OpenSSL functions. We should migrate to this version (0.15.6 as of time of writing)

The API has changed quite a bit, but our use of the API itself is quite limited, so this shouldn't be too much of an issue.

zarda commented 5 years ago

The last master branch 0.15.6 is not lib.so any more. The branch 0.15.6 is header only api which rely on uSocket. This means we need lot of modification about building. At least the dependency of libuv or epoll need to be addressed.

veggiesaurus commented 5 years ago

this shouldn't be too hard to change. uSocket is a pretty minor dependency

ghost commented 5 years ago

Hello,

New code is header only (just include it) and cross-platform C (without any dependencies) with optionally OpenSSL and zlib as dependencies. Windows is the only platform which need libuv

veggiesaurus commented 5 years ago

Hello,

New code is header only (just include it) and cross-platform C (without any dependencies) with optionally OpenSSL and zlib as dependencies. Windows is the only platform which need libuv

@alexhultman thanks for the info!

zarda commented 5 years ago

Do we need to include uWebSockets in submodules?

veggiesaurus commented 5 years ago

Do we need to include uWebSockets in submodules?

that's probably a good idea. However, we first need to check if the backend can work nicely with C++17 compilers. I'm a bit concerned about RedHat support in that regard.

markccchiang commented 3 years ago

I have created a test branch mark/upgrade_uWebSockets, which applies the latest version of uWebSockets. In the new uWebSockets, the libuv is wrapped in the submodule uSockets. Since it lacks detailed instruction on how to apply the async mechanism for our needs. The current solution is to slightly modify the uSockets (as well as uWebSockets) in order to access the uv loop directly. The installation script for the modified version of uWebSockets is here. Modifying the uWebSockets maybe not a good way, unless there is a significant improvement of the performance (it needs tests). I will keep understanding the new websockets code and try to avoid changing it.

veggiesaurus commented 3 years ago

I suggest you contact the uWebSockets author for details on how to do this upgrade and handle our async code

markccchiang commented 3 years ago

I think I found the solution. According to #1050 from the uWebSockets repo. We can use uWS::Loop::defer(function) to send websockets messages. I have changed the code and it works fine. So we don't need to modify the uSockets and uWebSockets.

ghost commented 3 years ago

uWS::Loop::get() can be directly cast to uv_loop_t if you are compiling for libuv. But you can also use defer as a wrapper around uv_async_t

markccchiang commented 3 years ago

uWS::Loop::get() can be directly cast to uv_loop_t if you are compiling for libuv. But you can also use defer as a wrapper around uv_async_t

@alexhultman Thank you for the suggestion! And your great work!