Giter VIP home page Giter VIP logo

Comments (2)

dave-andersen avatar dave-andersen commented on July 17, 2024

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.

manugoyal avatar manugoyal commented on July 17, 2024

Closing due to inactivity. Feel free to re-open if necessary.

from libcuckoo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.