Slackbot
06/02/2025, 8:30 AMKishore Nallan
06/02/2025, 8:33 AMHarpreet Sangar
06/02/2025, 8:54 AMprice: [61..1000000] filter takes the same time? The second value should be the largest value of your dataset.Dhia
06/02/2025, 9:18 AMDhia
06/02/2025, 9:20 AMfilter_by hits timing facet(price) total_values
price:>61 7331753 ~4200ms 18787
price:[61..499900000] 7331992 ~4500ms 18788
price:[61..4999000] 7331969 ~4500ms 18763
price:[61..499900] 7331104 ~4500ms 18105
price:[61..49990] 7296188 ~3600ms 9792
price:[61..4999] 6809221 ~850ms 3436
i also run facet on price (in seperate query to not impact timing) to check how many values in each range "facet_by":"price" and fetched results[0].facet_counts[0].stats.total_valuesHarpreet Sangar
06/02/2025, 9:27 AMHarpreet Sangar
06/02/2025, 9:28 AMDhia
06/02/2025, 9:28 AMHarpreet Sangar
06/02/2025, 9:29 AMDhia
06/02/2025, 9:38 AMprice:[61..49990] compared to test 4 price:[61..499900]
β’ we have hits: 7.2M vs 7.3M 0.5% less
β’ we have timing: 3.6s vs 4.5s 20% less
in test 6 price:[61..4999] westill have 6.8M hit and timing did drop by 80%
it seems like some kind of cliff, it could be cache spilling/trashing that create the cliff or another compeonet that i didn't account forDhia
06/02/2025, 9:38 AMKishore Nallan
06/02/2025, 9:40 AM61: [100]
62: [99, 1000, 2034]
63: [38483]
So the actual range matters because of the distribution of IDs within those individual numbers in the range.Dhia
06/02/2025, 9:41 AMDhia
06/02/2025, 9:46 AMfilter_by hits timing facet(price) total_values
price:<499900000 14844977 ~800ms 18826
price:<4999000 14844951 ~800ms 18801
price:<499900 14844080 ~800ms 18143
price:<49990 14809157 ~900ms 9829
Price:<4999 14322170 ~900ms 3473Kishore Nallan
06/02/2025, 9:46 AMKishore Nallan
06/02/2025, 9:48 AMrange_index option. It will consolidate those IDs and the queries will be very fast (memory cpu trade-off)Dhia
06/02/2025, 9:49 AMKishore Nallan
06/02/2025, 9:49 AMDhia
06/02/2025, 9:50 AMHarpreet Sangar
06/02/2025, 9:51 AMHarpreet Sangar
06/02/2025, 10:06 AMDhia
06/02/2025, 10:07 AMDhia
06/02/2025, 11:11 AMDhia
06/02/2025, 11:25 AMDhia
06/02/2025, 11:26 AMDhia
06/02/2025, 11:32 AM"created_at": 1748862323,
"default_sorting_field": "",
"enable_nested_fields": true,
"fields": [
{
"facet": true,
"index": true,
"infix": false,
"locale": "",
"name": "price",
"optional": true,
"range_index": true,
"sort": true,
"stem": false,
"stem_dictionary": "",
"store": true,
"type": "int64"
}
],
"name": "dhia_test_price_2",
"num_documents": 8016392,
"symbols_to_index": [],
"token_separators": []
}Dhia
06/02/2025, 2:38 PM:> or :<, it'a a matter of what data is fetched.
this trace perf seems interesting to me 82% of time spent in id_list_t::uncompress(std::vector<unsigned int, std::allocator<unsigned int> >&) and it causes a lot of page faults
- 98,75% 0,00% typesense-serve libc.so.6 [.] 0x0000727d1ad5dee8 β
0x727d1ad5dee8
- std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)
- 86,39% std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::_
- 86,37% post_multi_search(std::shared_ptr<http_req> const&, std::shared_ptr<http_res>const&)
- 86,36% CollectionManager::do_search(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::chβ
- 86,35% Collection::search[abi:cxx11](collection_search_args_t&) const
- 86,33% Index::run_search(search_args*)
- 86,33% Index::search(std::vector<query_tokens_t, std::allocator<query_tokens_t> >&, std::vector<search_field_t, std::allocator<search_field_t> > const&, text_match_type_t, std::unique_ptr<filter_node_t, std::default_delete<filter_node_t> >&, std::vβ
- 86,28% filter_result_iterator_t::filter_result_iterator_t(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Index const*, filter_node_t const*, bool const&, unsigned long const&, unsigned long, unsigned longβ
filter_result_iterator_t::init(bool const&, bool const&)
- NumericTrie::search_greater_than(long const&, bool const&, unsigned int*&, unsigned int&)
- 85,80% NumericTrie::Node::search_greater_than(long const&, char const&, unsigned int*&, unsigned int&)
- 82,09% id_list_t::uncompress(std::vector<unsigned int, std::allocator<unsigned int> >&)
- 32,26% 0x727d1ae64be7
- 31,21% asm_exc_page_fault
- 27,58% exc_page_faultDhia
06/02/2025, 2:39 PMHarpreet Sangar
06/02/2025, 2:45 PM>61 and <61 case, these queries are matching 512 nodes and 35 nodes respectively. It explains the difference in response time. id_list_t::uncompress is called on each node.Dhia
06/02/2025, 2:50 PMKishore Nallan
06/02/2025, 2:52 PMKishore Nallan
06/04/2025, 4:09 AM29.0.rc28 that contains a fix for this issue.Dhia
06/04/2025, 6:34 AMDhia
06/04/2025, 12:42 PMKishore Nallan
06/04/2025, 1:05 PM