beats icon indicating copy to clipboard operation
beats copied to clipboard

[Packetbeat] Extend Packetbeat to support multiple goroutines

Open taylor-swanson opened this issue 2 years ago • 4 comments

Packetbeat currently performs all reading and processing of packet data on one goroutine. This prevents Packetbeat from scaling on machines with more than one CPU core, at least in one process. There is at least another goroutine that handles reading off an event queue and submitting to an output.

Deciding how many goroutines to spin up, and which ones will do the work for which protocols, will be a challenge. There are features within AF_PACKET for load balancing, but Packetbeat does not yet support them. One such feature is PACKET_FANOUT_HASH, which will use a flow hash to route traffic between different sockets. That is something that could be explored as part of this change. Another option would be to broker incoming packet data to generic set of worker goroutines (all protos/ports have equal share), or perhaps each protocol or port gets a specific allotment.

taylor-swanson avatar Mar 02 '23 14:03 taylor-swanson

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

elasticmachine avatar Mar 02 '23 14:03 elasticmachine

Pinging @elastic/sec-linux-platform (Team:Security-Linux Platform)

elasticmachine avatar Jan 31 '24 19:01 elasticmachine

Any update on this? Whats the alternative for high traffic interfaces? For ex: 10GbE

gaby avatar Apr 29 '24 13:04 gaby

This is actually fixed by https://github.com/elastic/beats/pull/35453

gaby avatar Apr 29 '24 13:04 gaby

The changes from https://github.com/elastic/beats/pull/35453 would help this but the implementation is too complicated.

It would make more sense to have packetbeat have a config packetbeat.workers: 3 that creates several workers with the same fanout group. Instead of the user having duplicated files.

I'm currently deploying Packetbeat using ansible and this requires creating custom systemd files to be able to run multiple packetbeat instances which is very prone to errors.

I have a 10GbE interface and packetbeat data takes 10-30 minutes to even show up in ElasticSearch given how slow Packetbeat is with 1 instance.

Thoughts @andrewkroh @taylor-swanson

gaby avatar Aug 20 '24 12:08 gaby