Skip to content

Commit

Permalink
geyser: use runtime instaed of unconstrained (#332)
Browse files Browse the repository at this point in the history
fanatid committed May 17, 2024

Verified

This commit was signed with the committer’s verified signature.
fanatid Kirill Fomichev
1 parent 9f1dbd7 commit 43bd81a
Showing 8 changed files with 75 additions and 32 deletions.
45 changes: 35 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -6,6 +6,9 @@ concurrency:
cancel-in-progress: true

on:
pull_request:
paths:
- '.github/workflows/release.yml'
push:
branches:
- 'master'
@@ -75,16 +78,6 @@ jobs:
- name: Build release tarball
run: ./ci/create-tarball.sh

- name: Rename binaries for ubuntu22 release
if: matrix.os == 'ubuntu-22.04'
run: |
mv target/release/client target/release/client-22
mv target/release/config-check target/release/config-check-22
mv target/release/grpc-google-pubsub target/release/grpc-google-pubsub-22
mv target/release/grpc-kafka target/release/grpc-kafka-22
mv ${{ env.GEYSER_PLUGIN_NAME }}-release-x86_64-unknown-linux-gnu.tar.bz2 ${{ env.GEYSER_PLUGIN_NAME }}-release22-x86_64-unknown-linux-gnu.tar.bz2
mv ${{ env.GEYSER_PLUGIN_NAME }}-release-x86_64-unknown-linux-gnu.yml ${{ env.GEYSER_PLUGIN_NAME }}-release22-x86_64-unknown-linux-gnu.yml
- name: Deleteing directories to avoid upload conflict
run: |
rm -rf \
@@ -93,6 +86,27 @@ jobs:
target/release/grpc-google-pubsub.d \
target/release/grpc-kafka.d
- name: Remove debug information
run: |
strip \
target/release/client \
target/release/config-check \
target/release/grpc-google-pubsub \
target/release/grpc-kafka
- name: Rename binaries
run: |
mv target/release/client target/release/client-${{ matrix.os }}
mv target/release/config-check target/release/config-check-${{ matrix.os }}
mv target/release/grpc-google-pubsub target/release/grpc-google-pubsub-${{ matrix.os }}
mv target/release/grpc-kafka target/release/grpc-kafka-${{ matrix.os }}
- name: Rename lib for ubuntu22 release
if: matrix.os == 'ubuntu-22.04'
run: |
mv ${{ env.GEYSER_PLUGIN_NAME }}-release-x86_64-unknown-linux-gnu.tar.bz2 ${{ env.GEYSER_PLUGIN_NAME }}-release22-x86_64-unknown-linux-gnu.tar.bz2
mv ${{ env.GEYSER_PLUGIN_NAME }}-release-x86_64-unknown-linux-gnu.yml ${{ env.GEYSER_PLUGIN_NAME }}-release22-x86_64-unknown-linux-gnu.yml
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
@@ -109,3 +123,14 @@ jobs:
target/release/config-check*
target/release/grpc-google-pubsub*
target/release/grpc-kafka*
- uses: actions/upload-artifact@v4
with:
name: yellowstone-grpc-${{ github.sha }}-${{ matrix.os }}
path: |
${{ env.GEYSER_PLUGIN_NAME }}-release*
yellowstone-grpc-proto/proto/*.proto
target/release/client*
target/release/config-check*
target/release/grpc-google-pubsub*
target/release/grpc-kafka*
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -16,6 +16,17 @@ The minor version will be incremented upon a breaking change and the patch versi

### Breaking

## 2024-05-17

- yellowstone-grpc-client-1.15.0+solana.1.17.33
- yellowstone-grpc-geyser-1.14.2+solana.1.17.33
- yellowstone-grpc-proto-1.14.0+solana.1.17.33
- yellowstone-grpc-tools-1.0.0-rc.11+solana.1.17.33

### Features

- geyser: use runtime instaed of unconstrained ([#332](https://github.com/rpcpool/yellowstone-grpc/pull/332))

## 2024-05-15

- yellowstone-grpc-client-1.15.0+solana.1.17.33
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ resolver = "2"
members = [
"examples/rust", # 1.13.0+solana.1.17.33
"yellowstone-grpc-client", # 1.15.0+solana.1.17.33
"yellowstone-grpc-geyser", # 1.14.1+solana.1.17.33
"yellowstone-grpc-geyser", # 1.14.2+solana.1.17.33
"yellowstone-grpc-proto", # 1.14.0+solana.1.17.33
"yellowstone-grpc-tools", # 1.0.0-rc.11+solana.1.17.33
]
2 changes: 1 addition & 1 deletion yellowstone-grpc-geyser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yellowstone-grpc-geyser"
version = "1.14.1+solana.1.17.33"
version = "1.14.2+solana.1.17.33"
authors = { workspace = true }
edition = { workspace = true }
description = "Yellowstone gRPC Geyser Plugin"
22 changes: 16 additions & 6 deletions yellowstone-grpc-geyser/src/grpc.rs
Original file line number Diff line number Diff line change
@@ -27,7 +27,9 @@ use {
},
tokio::{
fs,
runtime::Builder,
sync::{broadcast, mpsc, Mutex, Notify, RwLock, Semaphore},
task::spawn_blocking,
time::{sleep, Duration, Instant},
},
tokio_stream::wrappers::ReceiverStream,
@@ -783,12 +785,20 @@ impl GrpcService {

// Run geyser message loop
let (messages_tx, messages_rx) = mpsc::unbounded_channel();
tokio::spawn(tokio::task::unconstrained(Self::geyser_loop(
messages_rx,
blocks_meta_tx,
broadcast_tx,
block_fail_action,
)));
spawn_blocking(move || {
Builder::new_multi_thread()
.thread_name_fn(crate::get_thread_name)
.worker_threads(4)
.enable_all()
.build()
.expect("Failed to create a new runtime for geyser loop")
.block_on(Self::geyser_loop(
messages_rx,
blocks_meta_tx,
broadcast_tx,
block_fail_action,
));
});

// Run Server
let shutdown = Arc::new(Notify::new());
8 changes: 8 additions & 0 deletions yellowstone-grpc-geyser/src/lib.rs
Original file line number Diff line number Diff line change
@@ -8,3 +8,11 @@ pub mod grpc;
pub mod plugin;
pub mod prom;
pub mod version;

pub fn get_thread_name() -> String {
use std::sync::atomic::{AtomicUsize, Ordering};

static ATOMIC_ID: AtomicUsize = AtomicUsize::new(0);
let id = ATOMIC_ID.fetch_add(1, Ordering::Relaxed);
format!("solGeyserGrpc{id:02}")
}
15 changes: 2 additions & 13 deletions yellowstone-grpc-geyser/src/plugin.rs
Original file line number Diff line number Diff line change
@@ -9,14 +9,7 @@ use {
ReplicaEntryInfoVersions, ReplicaTransactionInfoVersions, Result as PluginResult,
SlotStatus,
},
std::{
concat, env,
sync::{
atomic::{AtomicUsize, Ordering},
Arc,
},
time::Duration,
},
std::{concat, env, sync::Arc, time::Duration},
tokio::{
runtime::{Builder, Runtime},
sync::{mpsc, Notify},
@@ -68,11 +61,7 @@ impl GeyserPlugin for Plugin {

// Create inner
let runtime = Builder::new_multi_thread()
.thread_name_fn(|| {
static ATOMIC_ID: AtomicUsize = AtomicUsize::new(0);
let id = ATOMIC_ID.fetch_add(1, Ordering::Relaxed);
format!("solGeyserGrpc{id:02}")
})
.thread_name_fn(crate::get_thread_name)
.enable_all()
.build()
.map_err(|error| GeyserPluginError::Custom(Box::new(error)))?;

0 comments on commit 43bd81a

Please sign in to comment.