Comments (2)
Hi, Pavel - you should tryrunning your code under 'perf' to get a good idea
of the bottleneck
But my initial thought is that you're slowing down bigtime by doing string
operations on every packet Converting an IP to a string is very slow and
expensive. Try taking all of those and instead smash the IP + port into
two 64 bit integers:
struct flowID {
uint64_t id1, id1
}
flowID fid;
fid.id1 = current_packet.src_ip << 32 + current_packet.dest_ip
fid.id2 = uint64_t flowID2 = current_packet.source_port << 32+
current_packet.destination_port << 16 + current_packet.protocol
And then use that as the connection tracking ID.
-Dave
On Tue, May 12, 2015 at 12:53 PM Pavel Odintsov [email protected]
wrote:
Hello, folks!
I'm developing connection tracking toolkit and trying to replace std::map
with mutexes with libcuckoo.But unfortunately it slightly faster, my std::map version have performance
about 400 kpps. libcuckoo could achieve about 800 kpps.My workload pattern: 4 threads and random src/ip/ports which used as key:
if (packet_direction == OUTGOING or packet_direction == INCOMING) { std::string connection_tracking_hash_string = convert_ip_as_uint_to_string(current_packet.dst_ip) + "_" + convert_ip_as_uint_to_string(current_packet.src_ip) + "_" + convert_ip_as_uint_to_string(current_packet.source_port) + "_" + convert_ip_as_uint_to_string(current_packet.destination_port) + "_" + convert_ip_as_uint_to_string(current_packet.protocol) + "_"; get_direction_name(packet_direction); map_element temp_element; if (flow_tracking_table_new_generation.find(connection_tracking_hash_string, temp_element)) { // found! } else { // not found, create it flow_tracking_table_new_generation.insert(connection_tracking_hash_string, temp_element); } }
Could you recommend anything for me?
Reply to this email directly or view it on GitHub
#10.
from libcuckoo.
Closing due to inactivity. Feel free to re-open if necessary.
from libcuckoo.
Related Issues (20)
- The memory used is very high HOT 4
- cuckoohashmap taking high memory HOT 4
- Warnings and and test failure in test_resize on x86 Linux HOT 6
- add cursor without table lock?
- 32-bit unit_tests errors and compiler warnings HOT 3
- Strange behavior of tests for different architectures HOT 6
- valgrind reports Invalid free() / delete / delete[] / realloc() during map destructor HOT 11
- High spinlock overhead HOT 4
- Segfault in bucket_container copy constructor HOT 3
- terminated with exception libcuckoo::load_factor_too_low HOT 2
- find_fn vs. update_fn HOT 2
- Horrible scalability of my experiment HOT 1
- Why does `insert_or_assign` require the value to be CopyAssignable? HOT 1
- simple question about update_fn HOT 1
- How to integrate xxHash? HOT 1
- Segmentation fault on inserts HOT 3
- Missing keys HOT 3
- High contention under many reader threads on hot keys HOT 4
- Bundled Catch library fails to compile with recent C++ HOT 3
- .clear() taking too long HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libcuckoo.