update chrossbeam, tracy, prometheus (and reduce server deps to crossbeam-channel)

This commit is contained in:
Marcel Märtens 2020-12-16 00:51:07 +01:00
parent 198b1970a7
commit 26918d10c9
24 changed files with 83 additions and 113 deletions

92
Cargo.lock generated
View File

@ -193,15 +193,6 @@ version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
[[package]]
name = "arrayvec"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9"
dependencies = [
"nodrop",
]
[[package]]
name = "arrayvec"
version = "0.5.1"
@ -403,7 +394,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a"
dependencies = [
"arrayref",
"arrayvec 0.5.1",
"arrayvec",
"constant_time_eq",
]
@ -414,7 +405,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9ff35b701f3914bdb8fad3368d822c766ef2858b2583198e41639b936f09d3f"
dependencies = [
"arrayref",
"arrayvec 0.5.1",
"arrayvec",
"cc",
"cfg-if 0.1.10",
"constant_time_eq",
@ -1099,16 +1090,16 @@ dependencies = [
[[package]]
name = "crossbeam"
version = "0.7.2"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d818a4990769aac0c7ff1360e233ef3a41adcb009ebb2036bf6915eb0f6b23c"
checksum = "fd01a6eb3daaafa260f6fc94c3a6c36390abc2080e38e3e34ced87393fb77d80"
dependencies = [
"cfg-if 0.1.10",
"crossbeam-channel 0.3.9",
"crossbeam-deque 0.7.3",
"crossbeam-epoch 0.7.2",
"crossbeam-queue 0.1.2",
"crossbeam-utils 0.6.6",
"cfg-if 1.0.0",
"crossbeam-channel 0.5.0",
"crossbeam-deque 0.8.0",
"crossbeam-epoch 0.9.0",
"crossbeam-queue 0.3.1",
"crossbeam-utils 0.8.0",
]
[[package]]
@ -1162,20 +1153,6 @@ dependencies = [
"crossbeam-utils 0.8.0",
]
[[package]]
name = "crossbeam-epoch"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9"
dependencies = [
"arrayvec 0.4.12",
"cfg-if 0.1.10",
"crossbeam-utils 0.6.6",
"lazy_static",
"memoffset",
"scopeguard",
]
[[package]]
name = "crossbeam-epoch"
version = "0.8.2"
@ -1205,15 +1182,6 @@ dependencies = [
"scopeguard",
]
[[package]]
name = "crossbeam-queue"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b"
dependencies = [
"crossbeam-utils 0.6.6",
]
[[package]]
name = "crossbeam-queue"
version = "0.2.3"
@ -1225,6 +1193,16 @@ dependencies = [
"maybe-uninit",
]
[[package]]
name = "crossbeam-queue"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f6cb3c7f5b8e51bc3ebb73a2327ad4abdbd119dc13223f14f961d2f38486756"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils 0.8.0",
]
[[package]]
name = "crossbeam-utils"
version = "0.6.6"
@ -3156,12 +3134,6 @@ dependencies = [
"libc",
]
[[package]]
name = "nodrop"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
[[package]]
name = "noise"
version = "0.6.0"
@ -3837,11 +3809,11 @@ dependencies = [
[[package]]
name = "prometheus"
version = "0.10.0"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30d70cf4412832bcac9cffe27906f4a66e450d323525e977168c70d1b36120ae"
checksum = "c8425533e7122f0c3cc7a37e6244b16ad3a2cc32ae7ac6276e2a75da0d9c200d"
dependencies = [
"cfg-if 0.1.10",
"cfg-if 1.0.0",
"fnv",
"lazy_static",
"parking_lot 0.11.0",
@ -4524,7 +4496,7 @@ version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5f08237e667ac94ad20f8878b5943d91a93ccb231428446c57c21c57779016d"
dependencies = [
"arrayvec 0.5.1",
"arrayvec",
"hashbrown 0.7.2",
"mopa",
"rayon",
@ -5231,9 +5203,9 @@ dependencies = [
[[package]]
name = "tracing-tracy"
version = "0.3.0"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f70411ba0d11c4aee042b1c73e68086322a293f8038c53ac95d36319c91ec19"
checksum = "b668a0e08f29842a38973cc33317dba03a3062538c762df7425aa6397bce480a"
dependencies = [
"tracing-core",
"tracing-subscriber",
@ -5242,18 +5214,18 @@ dependencies = [
[[package]]
name = "tracy-client"
version = "0.9.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb214203bffe8cefe9bc0dfc12140f85e8d59b42e1f52f696071fdf8595e066a"
checksum = "9e8ccdb37ca05e354a50011b8a195f115215e46324f65be92495859882cea453"
dependencies = [
"tracy-client-sys",
]
[[package]]
name = "tracy-client-sys"
version = "0.10.0"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b1b6565366c88aa66599426f400751c5cd7a315f6493b3578da309ae686aaf1"
checksum = "1ee6f0f7878155b6102ab5aba86a92ec4357702ad44683df68ab5493ba3c86a2"
dependencies = [
"cc",
]
@ -5645,7 +5617,7 @@ version = "0.8.0"
dependencies = [
"authc",
"chrono",
"crossbeam",
"crossbeam-channel 0.5.0",
"diesel",
"diesel_migrations",
"dotenv",
@ -5818,7 +5790,7 @@ dependencies = [
"bincode",
"bitflags",
"clap",
"crossbeam-channel 0.4.4",
"crossbeam-channel 0.5.0",
"futures 0.3.5",
"lazy_static",
"lz-fear",

View File

@ -14,7 +14,7 @@ default = ["simd"]
[dependencies]
arraygen = "0.1.13"
crossbeam = "0.7"
crossbeam = "0.8"
enum-iterator = "0.6"
lazy_static = "1.4.0"
num-derive = "0.3"
@ -55,7 +55,7 @@ csv = { version = "1.1.3", optional = true }
structopt = { version = "0.3.13", optional = true }
# Tracy
tracy-client = { version = "0.9.0", optional = true }
tracy-client = { version = "0.10.0", optional = true }
[dev-dependencies]
#bench

View File

@ -30,4 +30,4 @@ specs = { git = "https://github.com/amethyst/specs.git", features = ["serde", "s
serde = { version = "1.0.110", features = ["derive"] }
# Tracy
tracy-client = { version = "0.9.0", optional = true }
tracy-client = { version = "0.10.0", optional = true }

View File

@ -1,19 +1,19 @@
use std::sync::atomic::AtomicI64;
use std::sync::atomic::AtomicU64;
#[derive(Default)]
pub struct SysMetrics {
pub agent_ns: AtomicI64,
pub mount_ns: AtomicI64,
pub controller_ns: AtomicI64,
pub character_behavior_ns: AtomicI64,
pub stats_ns: AtomicI64,
pub phys_ns: AtomicI64,
pub projectile_ns: AtomicI64,
pub melee_ns: AtomicI64,
pub agent_ns: AtomicU64,
pub mount_ns: AtomicU64,
pub controller_ns: AtomicU64,
pub character_behavior_ns: AtomicU64,
pub stats_ns: AtomicU64,
pub phys_ns: AtomicU64,
pub projectile_ns: AtomicU64,
pub melee_ns: AtomicU64,
}
#[derive(Default)]
pub struct PhysicsMetrics {
pub entity_entity_collision_checks: i64,
pub entity_entity_collisions: i64,
pub entity_entity_collision_checks: u64,
pub entity_entity_collisions: u64,
}

View File

@ -32,7 +32,7 @@ specs = { git = "https://github.com/amethyst/specs.git", features = ["serde", "s
serde = { version = "1.0.110", features = ["derive"] }
# Tracy
tracy-client = { version = "0.9.0", optional = true }
tracy-client = { version = "0.10.0", optional = true }
# Plugins
toml = { version = "0.5.7", optional = true }

View File

@ -1488,7 +1488,7 @@ impl<'a> System<'a> for Sys {
}
}
sys_metrics.agent_ns.store(
start_time.elapsed().as_nanos() as i64,
start_time.elapsed().as_nanos() as u64,
std::sync::atomic::Ordering::Relaxed,
);
}

View File

@ -206,7 +206,7 @@ impl<'a> System<'a> for Sys {
incorporate_update(&mut tuple, state_update);
}
sys_metrics.character_behavior_ns.store(
start_time.elapsed().as_nanos() as i64,
start_time.elapsed().as_nanos() as u64,
std::sync::atomic::Ordering::Relaxed,
);
}

View File

@ -121,7 +121,7 @@ impl<'a> System<'a> for Sys {
}
}
sys_metrics.controller_ns.store(
start_time.elapsed().as_nanos() as i64,
start_time.elapsed().as_nanos() as u64,
std::sync::atomic::Ordering::Relaxed,
);
}

View File

@ -157,7 +157,7 @@ impl<'a> System<'a> for Sys {
}
}
sys_metrics.melee_ns.store(
start_time.elapsed().as_nanos() as i64,
start_time.elapsed().as_nanos() as u64,
std::sync::atomic::Ordering::Relaxed,
);
}

View File

@ -93,7 +93,7 @@ impl<'a> System<'a> for Sys {
mountings.remove(entity);
}
sys_metrics.mount_ns.store(
start_time.elapsed().as_nanos() as i64,
start_time.elapsed().as_nanos() as u64,
std::sync::atomic::Ordering::Relaxed,
);
}

View File

@ -761,7 +761,7 @@ impl<'a> System<'a> for Sys {
event_emitter.emit(ServerEvent::LandOnGround { entity, vel: vel.0 });
});
sys_metrics.phys_ns.store(
start_time.elapsed().as_nanos() as i64,
start_time.elapsed().as_nanos() as u64,
std::sync::atomic::Ordering::Relaxed,
);
}

View File

@ -233,7 +233,7 @@ impl<'a> System<'a> for Sys {
.unwrap_or_default();
}
sys_metrics.projectile_ns.store(
start_time.elapsed().as_nanos() as i64,
start_time.elapsed().as_nanos() as u64,
std::sync::atomic::Ordering::Relaxed,
);
}

View File

@ -160,7 +160,7 @@ impl<'a> System<'a> for Sys {
}
}
sys_metrics.stats_ns.store(
start_time.elapsed().as_nanos() as i64,
start_time.elapsed().as_nanos() as u64,
std::sync::atomic::Ordering::Relaxed,
);
}

View File

@ -18,13 +18,13 @@ default = ["metrics","compression"]
bincode = "1.2"
serde = { version = "1.0" }
#sending
crossbeam-channel = "0.4.2"
crossbeam-channel = "0.5"
# NOTE: Upgrading async-std can trigger spontanious crashes for `network`ing. Consider elaborate tests before upgrading
async-std = { version = "~1.5", default-features = false, features = ["std", "async-task", "default"] }
#tracing and metrics
tracing = { version = "0.1", default-features = false }
tracing-futures = "0.2"
prometheus = { version = "0.10", default-features = false, optional = true }
prometheus = { version = "0.11", default-features = false, optional = true }
#async
futures = { version = "0.3", features = ["thread-pool"] }
#mpsc channel registry

View File

@ -1,6 +1,6 @@
use crate::types::{Cid, Frame, Pid};
use prometheus::{
core::{AtomicI64, GenericCounter},
core::{AtomicU64, GenericCounter},
IntCounter, IntCounterVec, IntGauge, IntGaugeVec, Opts, Registry,
};
use std::error::Error;
@ -281,7 +281,7 @@ pub(crate) struct PidCidFrameCache<T: MetricVecBuilder> {
pub(crate) struct MultiCidFrameCache {
metric: IntCounterVec,
cache: Vec<[Option<GenericCounter<AtomicI64>>; Frame::FRAMES_LEN as usize]>,
cache: Vec<[Option<GenericCounter<AtomicU64>>; Frame::FRAMES_LEN as usize]>,
}
impl MultiCidFrameCache {
@ -307,7 +307,7 @@ impl MultiCidFrameCache {
]);
}
pub fn with_label_values(&mut self, cid: Cid, frame: &Frame) -> &GenericCounter<AtomicI64> {
pub fn with_label_values(&mut self, cid: Cid, frame: &Frame) -> &GenericCounter<AtomicU64> {
self.populate(cid);
let frame_int = frame.get_int() as usize;
let r = &mut self.cache[cid as usize][frame_int];
@ -322,7 +322,7 @@ impl MultiCidFrameCache {
}
pub(crate) struct CidFrameCache {
cache: [GenericCounter<AtomicI64>; Frame::FRAMES_LEN as usize],
cache: [GenericCounter<AtomicU64>; Frame::FRAMES_LEN as usize],
}
impl CidFrameCache {
@ -341,7 +341,7 @@ impl CidFrameCache {
Self { cache }
}
pub fn with_label_values(&mut self, frame: &Frame) -> &GenericCounter<AtomicI64> {
pub fn with_label_values(&mut self, frame: &Frame) -> &GenericCounter<AtomicU64> {
&self.cache[frame.get_int() as usize]
}
}

View File

@ -158,7 +158,7 @@ impl PrioManager {
self.metrics
.message_out_throughput
.with_label_values(&[&self.pid, &sid_string])
.inc_by(msg.buffer.data.len() as i64);
.inc_by(msg.buffer.data.len() as u64);
}
//trace!(?prio, ?sid_string, "tick");

View File

@ -182,7 +182,7 @@ impl TcpProtocol {
ref data,
} = frame
{
throughput_cache.inc_by(data.len() as i64);
throughput_cache.inc_by(data.len() as u64);
}
}
w2c_cid_frame_s
@ -291,7 +291,7 @@ impl TcpProtocol {
ref data,
} = frame
{
throughput_cache.inc_by(data.len() as i64);
throughput_cache.inc_by(data.len() as u64);
}
}
if let Err(e) = Self::write_frame(&mut stream, frame).await {
@ -372,7 +372,7 @@ impl UdpProtocol {
Frame::gen_data(*<&[u8; 18]>::try_from(&bytes[1..19]).unwrap());
let mut data = vec![0; length as usize];
#[cfg(feature = "metrics")]
throughput_cache.inc_by(length as i64);
throughput_cache.inc_by(length as u64);
data.copy_from_slice(&bytes[19..]);
Frame::Data { mid, start, data }
},
@ -459,7 +459,7 @@ impl UdpProtocol {
buffer[17..19].copy_from_slice(&(data.len() as u16).to_le_bytes());
buffer[19..(data.len() + 19)].clone_from_slice(&data[..]);
#[cfg(feature = "metrics")]
throughput_cache.inc_by(data.len() as i64);
throughput_cache.inc_by(data.len() as u64);
19 + data.len()
},
Frame::Raw(data) => {

View File

@ -27,7 +27,7 @@ ron = {version = "0.6", default-features = false}
serde = {version = "1.0", features = [ "rc", "derive" ]}
# Tracy
tracing-tracy = { version = "0.3.0", optional = true }
tracing-tracy = { version = "0.4.0", optional = true }
[dependencies.tui]
git = "https://github.com/fdehau/tui-rs.git"

View File

@ -37,8 +37,8 @@ serde_json = "1.0.50"
rand = { version = "0.7", features = ["small_rng"] }
chrono = "0.4.9"
hashbrown = { version = "0.7.2", features = ["rayon", "serde", "nightly"] }
crossbeam = "0.7.2"
prometheus = { version = "0.10", default-features = false}
crossbeam-channel = "0.5"
prometheus = { version = "0.11", default-features = false}
tiny_http = "0.7.0"
portpicker = { git = "https://github.com/xMAC94x/portpicker-rs" }
authc = { git = "https://gitlab.com/veloren/auth.git", rev = "b943c85e4a38f5ec60cd18c34c73097640162bfe" }

View File

@ -2,7 +2,6 @@ use crate::metrics::ChunkGenMetrics;
#[cfg(not(feature = "worldgen"))]
use crate::test_world::{IndexOwned, World};
use common::{generation::ChunkSupplement, terrain::TerrainChunk};
use crossbeam::channel;
use hashbrown::{hash_map::Entry, HashMap};
use specs::Entity as EcsEntity;
use std::sync::{
@ -19,15 +18,15 @@ type ChunkGenResult = (
);
pub struct ChunkGenerator {
chunk_tx: channel::Sender<ChunkGenResult>,
chunk_rx: channel::Receiver<ChunkGenResult>,
chunk_tx: crossbeam_channel::Sender<ChunkGenResult>,
chunk_rx: crossbeam_channel::Receiver<ChunkGenResult>,
pending_chunks: HashMap<Vec2<i32>, Arc<AtomicBool>>,
metrics: Arc<ChunkGenMetrics>,
}
impl ChunkGenerator {
#[allow(clippy::new_without_default)] // TODO: Pending review in #587
pub fn new(metrics: ChunkGenMetrics) -> Self {
let (chunk_tx, chunk_rx) = channel::unbounded();
let (chunk_tx, chunk_rx) = crossbeam_channel::unbounded();
Self {
chunk_tx,
chunk_rx,

View File

@ -1,5 +1,5 @@
use crate::{Client, ClientType, ServerInfo};
use crossbeam::{bounded, unbounded, Receiver, Sender};
use crossbeam_channel::{bounded, unbounded, Receiver, Sender};
use futures_channel::oneshot;
use futures_executor::block_on;
use futures_timer::Delay;

View File

@ -7,7 +7,7 @@ use common::{
character::{CharacterId, CharacterItem},
comp::item::tool::AbilityMap,
};
use crossbeam::{channel, channel::TryIter};
use crossbeam_channel::{self, TryIter};
use std::path::Path;
use tracing::error;
@ -65,14 +65,14 @@ pub struct CharacterLoaderResponse {
/// Responses are polled on each server tick in the format
/// [`CharacterLoaderResponse`]
pub struct CharacterLoader {
update_rx: channel::Receiver<CharacterLoaderResponse>,
update_tx: channel::Sender<CharacterLoaderRequest>,
update_rx: crossbeam_channel::Receiver<CharacterLoaderResponse>,
update_tx: crossbeam_channel::Sender<CharacterLoaderRequest>,
}
impl CharacterLoader {
pub fn new(db_dir: &Path, map: &AbilityMap) -> diesel::QueryResult<Self> {
let (update_tx, internal_rx) = channel::unbounded::<CharacterLoaderRequest>();
let (internal_tx, update_rx) = channel::unbounded::<CharacterLoaderResponse>();
let (update_tx, internal_rx) = crossbeam_channel::unbounded::<CharacterLoaderRequest>();
let (internal_tx, update_rx) = crossbeam_channel::unbounded::<CharacterLoaderResponse>();
let mut conn = establish_connection(db_dir)?;

View File

@ -2,7 +2,6 @@ use crate::comp;
use common::{character::CharacterId, comp::item::ItemId};
use crate::persistence::{establish_connection, VelorenConnection};
use crossbeam::channel;
use std::{path::Path, sync::Arc};
use tracing::{error, trace};
@ -19,14 +18,14 @@ pub type CharacterUpdateData = (
/// This is used to make updates to a character and their persisted components,
/// such as inventory, loadout, etc...
pub struct CharacterUpdater {
update_tx: Option<channel::Sender<Vec<(CharacterId, CharacterUpdateData)>>>,
update_tx: Option<crossbeam_channel::Sender<Vec<(CharacterId, CharacterUpdateData)>>>,
handle: Option<std::thread::JoinHandle<()>>,
}
impl CharacterUpdater {
pub fn new(db_dir: &Path) -> diesel::QueryResult<Self> {
let (update_tx, update_rx) =
channel::unbounded::<Vec<(CharacterId, CharacterUpdateData)>>();
crossbeam_channel::unbounded::<Vec<(CharacterId, CharacterUpdateData)>>();
let mut conn = establish_connection(db_dir)?;

View File

@ -63,7 +63,7 @@ bincode = "1.2"
chrono = "0.4.9"
cpal = "0.13"
copy_dir = "0.1.2"
crossbeam = "=0.7.2"
crossbeam = "0.8.0"
deunicode = "1.0"
# TODO: remove
directories-next = "2.0"
@ -88,7 +88,7 @@ inline_tweak = "1.0.2"
itertools = "0.9.0"
# Tracy
tracing-tracy = { version = "0.3.0", optional = true }
tracing-tracy = { version = "0.4.0", optional = true }
# Logging
termcolor = "1.1"