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

Perf JSON.SET json-parser-0000 ["\"web-app\""].servlet[0]["\"servlet-name\""] ["\"bar\""]: jsonpath_lib::parser::tokenizer::TokenReader::* represents 11% of on-CPU cycles of rejson.so #425

Open
filipecosta90 opened this issue Jul 13, 2021 · 0 comments
Labels
x:quality Code-Quality related (performance, test, etc. -not directly affecting functionality)

Comments

@filipecosta90
Copy link
Contributor

Collected with git_sha= f62cf86

To recollect ( Linux based only for now and requires perf ) :

make clean build benchmark PROFILE=1 BENCHMARK=json_set_[web-app].servlet[0][servlet-name]_bar_json-parser-0000.yml PERF_CALLGRAPH_MODE=dwarf

Top entries in text form (notice that the overall cpu% of jsonpath_lib::* )

# ========
# captured on: Tue Jul 13 15:28:47 2021
# hostname : hpe10
# os release : 4.15.0-147-generic
# perf version : 4.15.18
# arch : x86_64
# nrcpus online : 20
# nrcpus avail : 20
# cpudesc : Intel(R) Xeon(R) Gold 6230 CPU @ 2.10GHz
# cpuid : GenuineIntel,6,85,7
# total memory : 65610504 kB
# cmdline : /usr/lib/linux-tools-4.15.0-147/perf record -e cycles:pp -g --pid 6291 --output profile_json_set_[web-app].servlet[0][servlet-name]_bar_json-parser-0000_perf:record_2021-07-13-15-28-03.out --call-graph dwarf --freq 99 
# event : name = cycles:pp, , size = 112, { sample_period, sample_freq } = 99, sample_type = IP|TID|TIME|ADDR|CALLCHAIN|PERIOD|REGS_USER|STACK_USER|DATA_SRC, disabled = 1, inherit = 1, mmap = 1, comm = 1, freq = 1, task = 1, precise_ip = 2, mmap_data = 1, sample_id_all = 1, exclude_guest = 1, exclude_callchain_user = 1, mmap2 = 1, comm_exec = 1, sample_regs_user = 0xff0fff, sample_stack_user = 8192
# CPU_TOPOLOGY info available, use -I to display
# NUMA_TOPOLOGY info available, use -I to display
# pmu mappings: intel_pt = 7, intel_bts = 6, uncore_cha_1 = 28, uncore_irp_3 = 56, software = 1, uncore_cha_14 = 41, uncore_imc_5 = 16, uncore_m3upi_0 = 20, uncore_irp_1 = 54, uncore_m2m_1 = 10, uncore_cha_12 = 39, uncore_imc_3 = 14, uncore_cha_8 = 35, uncore_cha_10 = 37, uncore_imc_1 = 12, uncore_upi_1 = 18, power = 60, uncore_cha_6 = 33, uncore_cha_19 = 46, uncore_iio_4 = 51, cpu = 4, uncore_cha_4 = 31, uncore_m2pcie_2 = 25, uncore_cha_17 = 44, uncore_iio_2 = 49, cstate_core = 61, breakpoint = 5, uncore_cha_2 = 29, uncore_m2pcie_0 = 23, uncore_irp_4 = 57, uncore_cha_15 = 42, uncore_m3upi_1 = 21, uncore_iio_0 = 47, tracepoint = 2, uncore_cha_0 = 27, uncore_irp_2 = 55, uncore_cha_13 = 40, cstate_pkg = 62, uncore_imc_4 = 15, uncore_cha_9 = 36, uncore_ubox = 26, uncore_irp_0 = 53, uncore_m2m_0 = 9, uncore_cha_11 = 38, uncore_imc_2 = 13, uncore_upi_2 = 19, uncore_cha_7 = 34, uncore_iio_5 = 52, uncore_imc_0 = 11, uncore_upi_0 = 17, uncore_cha_5 = 32, uncore_pcu = 59, uncore_cha_18 = 45, msr = 8, uncore_iio_3 = 50, uncore_cha_3 = 30, uncore_m2pcie_1 = 24, uncore_irp_5 = 58, uncore_cha_16 = 43, uncore_m3upi_2 = 22, uncore_iio_1 = 48
# CACHE info available, use -I to display
# missing features: TRACING_DATA BRANCH_STACK GROUP_DESC AUXTRACE STAT 
# ========
#
# dso: /root/RedisJSON/target/release/rejson.so
#
# Total Lost Samples: 0
#
# Samples: 997  of event 'cycles:pp'
# Event count (approx.): 38169798746
#
# Overhead  Command       Symbol                                                                                                                             
# ........  ............  ...................................................................................................................................
#
     7.28%  redis-server  [.] jsonpath_lib::parser::tokenizer::TokenReader::next_token
     6.70%  redis-server  [.] <jsonpath_lib::select::Selector<T> as jsonpath_lib::parser::NodeVisitor>::visit_token
     4.50%  redis-server  [.] jsonpath_lib::parser::Parser::paths
     3.69%  redis-server  [.] jsonpath_lib::parser::tokenizer::TokenReader::new
     3.59%  redis-server  [.] jsonpath_lib::select::Selector<T>::compute_paths::_walk
     3.40%  redis-server  [.] indexmap::map::IndexMap<K,V,S>::get_index_of
     3.20%  redis-server  [.] jsonpath_lib::parser::Parser::array
     2.99%  redis-server  [.] jsonpath_lib::parser::path_reader::PathReader::next_char
     2.81%  redis-server  [.] jsonpath_lib::parser::Parser::paths_dot
     2.53%  redis-server  [.] serde_json::value::de::<impl serde::de::Deserialize for serde_json::value::Value>::deserialize
     2.23%  redis-server  [.] <std::collections::hash::map::DefaultHasher as core::hash::Hasher>::write
     2.14%  redis-server  [.] jsonpath_lib::parser::tokenizer::TokenReader::peek_token
     2.04%  redis-server  [.] indexmap::map::IndexMap<K,V,S>::hash
     2.04%  redis-server  [.] jsonpath_lib::parser::path_reader::PathReader::take_while
     1.94%  redis-server  [.] jsonpath_lib::select::FilterTerms<T>::collect_next_with_str
     1.75%  redis-server  [.] __rg_alloc
     1.55%  redis-server  [.] rejson::commands::command_json_set
     1.46%  redis-server  [.] jsonpath_lib::parser::NodeVisitor::visit
     1.46%  redis-server  [.] <std::collections::hash::map::DefaultHasher as core::hash::Hasher>::write
     1.46%  redis-server  [.] __rg_dealloc
     1.36%  redis-server  [.] alloc::raw_vec::finish_grow
     1.36%  redis-server  [.] jsonpath_lib::parser::Parser::array_quote_value
     1.36%  redis-server  [.] alloc::slice::<impl [T]>::to_vec_in
     1.26%  redis-server  [.] core::ptr::drop_in_place<jsonpath_lib::select::Selector<serde_json::value::Value>>
     1.26%  redis-server  [.] <rejson::manager::KeyHolderWrite as rejson::manager::WriteHolder<serde_json::value::Value,serde_json::value::Value>>::set_value
     1.07%  redis-server  [.] <core::str::lossy::Utf8LossyChunksIter as core::iter::traits::iterator::Iterator>::next
     1.07%  redis-server  [.] hashbrown::raw::inner::RawTable<T,A>::find
     1.07%  redis-server  [.] jsonpath_lib::select::Selector<T>::is_last_before_token_match
     1.07%  redis-server  [.] alloc::raw_vec::RawVec<T,A>::reserve
     0.97%  redis-server  [.] jsonpath_lib::parser::tokenizer::Tokenizer::quote
     0.97%  redis-server  [.] hashbrown::raw::RawTable<T>::reserve_rehash
     0.88%  redis-server  [.] jsonpath_lib::parser::Parser::close_token
     0.87%  redis-server  [.] core::ptr::drop_in_place<jsonpath_lib::parser::ParseToken>
     0.87%  redis-server  [.] alloc::vec::Vec<T,A>::retain
     0.87%  redis-server  [.] jsonpath_lib::parser::path_reader::PathReader::take_while
     0.87%  redis-server  [.] alloc::raw_vec::finish_grow
     0.87%  redis-server  [.] <T as redis_module::redismodule::NextArg>::next_string
     0.78%  redis-server  [.] core::ptr::drop_in_place<alloc::boxed::Box<jsonpath_lib::parser::Node>>
     0.78%  redis-server  [.] serde_json::de::from_str
     0.78%  redis-server  [.] <&mut W as core::fmt::Write>::write_str
     0.78%  redis-server  [.] jsonpath_lib::select::Selector<T>::select
     0.78%  redis-server  [.] <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
     0.78%  redis-server  [.] alloc::raw_vec::RawVec<T,A>::reserve
     0.77%  redis-server  [.] jsonpath_lib::parser::path_reader::PathReader::take_while
     0.68%  redis-server  [.] core::ptr::drop_in_place<core::option::Option<alloc::boxed::Box<jsonpath_lib::parser::Node>>>
     0.68%  redis-server  [.] core::ptr::drop_in_place<jsonpath_lib::parser::ParseToken>
     0.68%  redis-server  [.] <&str as std::ffi::c_str::CString::new::SpecIntoVec>::into_vec
     0.58%  redis-server  [.] <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
     0.58%  redis-server  [.] jsonpath_lib::select::Selector<T>::compute_paths
     0.49%  redis-server  [.] std::ffi::c_str::CString::_new
     0.49%  redis-server  [.] hashbrown::raw::RawTable<T>::insert
     0.49%  redis-server  [.] core::fmt::write
     0.49%  redis-server  [.] <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
     0.49%  redis-server  [.] alloc::raw_vec::RawVec<T,A>::reserve
     0.49%  redis-server  [.] rejson::RedisModule_OnLoad::__do_command
     0.49%  redis-server  [.] redis_module::redismodule::RedisString::into_string_lossy
     0.48%  redis-server  [.] jsonpath_lib::parser::Parser::key
     0.39%  redis-server  [.] __rust_dealloc
     0.39%  redis-server  [.] jsonpath_lib::select::FilterTerms<T>::collect_next_with_num
     0.39%  redis-server  [.] hashbrown::map::HashMap<K,V,S>::insert
     0.39%  redis-server  [.] __rust_alloc
     0.39%  redis-server  [.] <rejson::manager::RedisJsonKeyManager as rejson::manager::Manager>::from_str
     0.39%  redis-server  [.] alloc::raw_vec::RawVec<T,A>::reserve
     0.39%  redis-server  [.] alloc::raw_vec::finish_grow
     0.39%  redis-server  [.] core::fmt::Formatter::pad_integral
     0.39%  redis-server  [.] jsonpath_lib::select::Selector<T>::str_path
     0.39%  redis-server  [.] alloc::raw_vec::RawVec<T,A>::reserve
     0.39%  redis-server  [.] jsonpath_lib::parser::tokenizer::Token::is_match_token_type
     0.39%  redis-server  [.] <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
     0.29%  redis-server  [.] jsonpath_lib::select::json_node::<impl jsonpath_lib::select::select_value::SelectValue for serde_json::value::Value>::items
     0.29%  redis-server  [.] <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
     0.29%  redis-server  [.] <serde_json::read::StrRead as serde_json::read::Read>::parse_str
     0.29%  redis-server  [.] redis_module::key::verify_type
     0.29%  redis-server  [.] alloc::raw_vec::RawVec<T,A>::reserve
     0.29%  redis-server  [.] jsonpath_lib::parser::Parser::compile
     0.29%  redis-server  [.] alloc::string::String::insert_bytes
     0.29%  redis-server  [.] std::ffi::c_str::CString::from_vec_unchecked
     0.29%  redis-server  [.] redis_module::raw::notify_keyspace_event
     0.29%  redis-server  [.] <alloc::string::String as core::clone::Clone>::clone
     0.29%  redis-server  [.] <rejson::manager::KeyHolderWrite as rejson::manager::WriteHolder<serde_json::value::Value,serde_json::value::Value>>::get_value
     0.19%  redis-server  [.] __rg_realloc
     0.19%  redis-server  [.] <alloc::vec::Vec<T,A> as core::ops::drop::Drop>::drop
     0.19%  redis-server  [.] core::hash::impls::<impl core::hash::Hash for *const T>::hash
     0.19%  redis-server  [.] <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::next
     0.19%  redis-server  [.] jsonpath_lib::select::json_node::<impl jsonpath_lib::select::select_value::SelectValue for serde_json::value::Value>::get_key
     0.19%  redis-server  [.] jsonpath_lib::select::json_node::<impl jsonpath_lib::select::select_value::SelectValue for serde_json::value::Value>::get_type
     0.19%  redis-server  [.] redis_module::context::Context::reply
     0.19%  redis-server  [.] jsonpath_lib::select::Selector<T>::select_with_paths
     0.10%  redis-server  [.] core::num::<impl core::str::traits::FromStr for isize>::from_str
     0.10%  redis-server  [.] jsonpath_lib::parser::utils::string_to_num
     0.10%  redis-server  [.] jsonpath_lib::select::json_node::<impl jsonpath_lib::select::select_value::SelectValue for serde_json::value::Value>::values
     0.10%  redis-server  [.] alloc::raw_vec::RawVec<T,A>::reserve
     0.10%  redis-server  [.] redis_module::redismodule::decode_args
     0.10%  redis-server  [.] core::num::<impl core::str::traits::FromStr for usize>::from_str
     0.10%  redis-server  [.] serde_json::read::SliceRead::new
     0.10%  redis-server  [.] <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::size_hint
     0.10%  redis-server  [.] jsonpath_lib::parser::Parser::json_path
     0.10%  redis-server  [.] serde_json::value::Value::take
     0.10%  redis-server  [.] <T as redis_module::redismodule::NextArg>::next_arg
     0.10%  redis-server  [.] <alloc::vec::drain::Drain<T,A> as core::ops::drop::Drop>::drop
     0.10%  redis-server  [.] core::ptr::drop_in_place<serde_json::value::Value>

Flame Graph

svg link:
https://s3.us-east-2.amazonaws.com/ci.benchmarks.redislabs/RedisJSON/RedisJSON/profiles/json_set_[web-app].servlet[0][servlet-name]_bar_json-parser-0000/profile_json_set_%5Bweb-app%5D.servlet%5B0%5D%5Bservlet-name%5D_bar_json-parser-0000_perf%3Arecord_2021-07-13-15-28-03.out.flamegraph.svg

@filipecosta90 filipecosta90 added the x:quality Code-Quality related (performance, test, etc. -not directly affecting functionality) label Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:quality Code-Quality related (performance, test, etc. -not directly affecting functionality)
Projects
None yet
Development

No branches or pull requests

1 participant