Multithread sniff#1259
Closed
gpotter2 wants to merge 4 commits intosecdev:masterfrom
gpotter2:multithread-sniff
Closed
Multithread sniff#1259gpotter2 wants to merge 4 commits intosecdev:masterfrom gpotter2:multithread-sniff
gpotter2 wants to merge 4 commits intosecdev:masterfrom
gpotter2:multithread-sniff
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1259 +/- ##
==========================================
+ Coverage 85.34% 85.39% +0.05%
==========================================
Files 177 175 -2
Lines 40850 40583 -267
==========================================
- Hits 34862 34657 -205
+ Misses 5988 5926 -62
|
gpotter2
commented
Mar 27, 2018
scapy/arch/linux.py
Outdated
Member
Author
There was a problem hiding this comment.
Not sure if this name is really appropriate... The goal of this function is to receive without dissecting. Any ideas?
Member
|
recv_raw ?
|
gpotter2
commented
Jun 11, 2018
.travis/install.sh
Outdated
Member
Author
There was a problem hiding this comment.
See https://travis-ci.org/gpotter2/scapy/jobs/390697554
$ bash .travis/install.sh
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
tshark : Depends: libwireshark5 (>= 1.12.0~rc3) but it is not going to be installed
Depends: wireshark-common (= 1.12.1+g01b65bf-4+deb8u11ubuntu0.14.04.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
- Allow the recv() function to accept an argument from a previously received recv_raw() - Remove duplicated code from pcapdnet.py
Member
Author
|
I have doubts about the real performance improvement of this PR... |
Member
Author
|
I can't get this PR to go anywhere, and am only losing performances :/ Will leave it here in the meanwhile... I do think that using multiprocessing, and keeping this PR will improve the performances, but It seems maybe too hard to implement (sharing objects with multiprocessing is a pain), so I don't think the work is worth it.. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was a failure. See #1999
What it does
Split the sniffing process into several threads:
To make this work, it was needed to separate dissecting and recieving in the arch/ hooks: introducing
recv_async(of course name may be changed), which only recieves the packet as raw bytes. It is called by the olderrecv()functions, which will keep the same behaviorThis allows to split scapy's processing part from API calls. It free the buffer of the APIs into scapy's one.
Benchmark
Start 2 scapy instances
In the first one:
stats()Results
Those results already are an average
Edit: this seems wrong, as we are not using multiprocessing but threading, so the measuring methods are slowed down too, making the hole thing clunky.. Redoing the tests in a proper environment (two separate shells) makes the results very different
Conclusion
This PR improves the recieved packet / second rate by 281%
TODO & discussion