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

Message ingestion stops #15

Closed
hopeyen opened this issue Aug 14, 2023 · 4 comments
Closed

Message ingestion stops #15

hopeyen opened this issue Aug 14, 2023 · 4 comments
Assignees
Labels
meta:triaged This issue has been triaged (has a good description, as well as labels for priority, size and type) p1 High priority size:large Large type:bug Something isn't working

Comments

@hopeyen
Copy link
Contributor

hopeyen commented Aug 14, 2023

After periodic network reconnectio & added timestamps messages do not stop when running natively, but in Docker the messages still stop

@hopeyen
Copy link
Contributor Author

hopeyen commented Sep 5, 2023

We need to increase the performance of processing messages, as the current performance is only efficient for a small amount of messages flowing on the network. When the traffic becomes high (testing on testnet -> continuously running on mainnet), the process rate is lower than the receiving rate so the message queue grows indefinitely.

We explore the options to create separate runtimes or threads to allow concurrent processes.

Tokio Runtime

  • Fast and scalable network applications.
  • Event-driven, non-blocking I/O model using the async/await syntax - instead of threads being blocked waiting for I/O operations, the event loop can handle other tasks.
  • Tasks spawn asynchronously are more lightweight than threads. Multiple tasks can run on a single OS thread.
  • Asynchronous integrated I/O operations including TCP/UDP networking, filesystem operations, and timers.

Threads

  • General-purpose concurrent and parallel programming, especially for CPU-bound tasks.
  • More traditional method of achieving concurrency and parallelism on the OS-level.
  • Effective for CPU-bound tasks utilizing multiple cores; less efficient than asynchronous tasks for I/O-bound operations due to context switching.
  • Each thread has its own stack which can add up when spawning many threads, leading to high memory usage.

When to use which?

  • I/O-bound tasks such as a web server or a database, Runtime might be more efficient because of its non-blocking I/O model.
  • CPU-bound tasks for performing computations that are CPU-bound using multiple cores.

@chriswessels
Copy link
Member

Agreed we need to ensure that performance isn't a bottleneck, but is there any reason to believe this is what is causing message ingestion to stop?

@hopeyen
Copy link
Contributor Author

hopeyen commented Sep 6, 2023

but is there any reason to believe this is what is causing message ingestion to stop?

If I run two listener radio in parallel (one subscribed to testnet and one to mainnet), ingestion doesn't stop for testnet where there's significantly less traffic than mainnet. This doesn't necessarily mean performance is the cause of this issue, more so it could lead to a situation where the operator becomes occupied with receiving new messages and has no availability to processing messages into the DB

@pete-eiger pete-eiger added p1 High priority size:large Large meta:triaged This issue has been triaged (has a good description, as well as labels for priority, size and type) labels Sep 21, 2023
@hopeyen
Copy link
Contributor Author

hopeyen commented Sep 26, 2023

Can confirm that listener radio message ingestion is now continuous after

  • making a separate runtime for processing messages: a429546
  • periodically prune database: 0ce8b5b
  • deployed and monitored for 1 day on launchpad

@hopeyen hopeyen closed this as completed Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta:triaged This issue has been triaged (has a good description, as well as labels for priority, size and type) p1 High priority size:large Large type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants