Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Actix 0.13 APIs, Tokio 1.x, and fix OGN device DB download #439

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

mologie
Copy link

@mologie mologie commented May 8, 2023

(Please do not merge yet, this needs an update to Cargo.toml again after actix-ogn is released.)

I observed ogn-web-gateway on FVA's servers to spend >95% of its CPU time under load in Tokio, Actix, and the kernel [1]. CPU usage then remained at 7 full cores in the late evening, and restarting the service made it return to normal.

This PR replaces the 4+y old dependencies with recent ones just to rule out subtle bugs with recent Linux versions.

The issue may have started after FVA migrated to LXC for containerizing Linux (previously VMware ESXi), which updated the OGN VM's Linux kernel from 4.19 to 5.15 without changing userspace. It may also have been there forever already. We cannot really roll the whole thing back to check again on a busy day.

This depends on Turbo87/actix-ogn#32 being merged and released. Currently Cargo.toml points to ../actix-ogn for the on-master version.

Change summary:

  • Raises OGN device DB size limit from 4 MiB to 32 MiB; the server ships a >4 MiB file today.
  • No longer depends on OpenSSL
  • Uses Actix 0.13 and Actix-Web 4
  • Updated Sentry integration for compatibility and for removing OpenSSL, but I cannot it without personal account. Would appreciate if you could give this one a shot with your existing setup.

Tests done:

  • cargo test passes
  • Checked that echo 'bbox|-1.163826432568077|49.131099997360025|14.656486067431924|52.2073178286237' | websocat -n1 ws:https://localhost:9999/api/live still returns data
  • Checked that API status endpoint's positions counter increases after starting with an empty local redis database
  • I did not actually connect the ogn-web-viewer to this; npm install fails for me because it attempts to access phantomjs, which is not available for my platform (Apple M1), did not investigate this further.
  • Testing I did was without SENTRY_DSN set.

I did not update:

  • The Redis client. It is unmaintained and the compiler warns that future rust version cannot compile it.
  • clap command line parser, API changed and current version does its job.

[1] perf report when ogn-web-gateway was under load:
Screenshot 2023-05-07 at 00 11 27

@mologie mologie marked this pull request as draft May 8, 2023 13:43
Actix' default CORS policy would reject any request with a Origin
header. Updating dependencies thus broke the /api/live endpoint when
used from a browser. This configures Actix to permit requests from a
single configurable origin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant