Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving WinDivert perfomance by using BatchMode offered in WinDivertRecvEx #273

Open
trudyhood opened this issue Apr 16, 2021 · 6 comments · Fixed by #304
Open

Improving WinDivert perfomance by using BatchMode offered in WinDivertRecvEx #273

trudyhood opened this issue Apr 16, 2021 · 6 comments · Fixed by #304

Comments

@trudyhood
Copy link

trudyhood commented Apr 16, 2021

I have found out that WinDivert performance can be increased significantly by using batch mode offered in WinDivertRecvEx. Can you implement WinDivertDevice with BatchMode using WinDivertRecvEx instead WinDivertRecv? The performance is near 3x on high bandwidth and CPU utilization looks lower.

Please consider WinDivertSendEx too.

@trudyhood
Copy link
Author

Sorry, no any comment about this?

@chmorgan
Copy link
Collaborator

chmorgan commented May 3, 2021 via email

@trudyhood
Copy link
Author

Very good, really waiting for that.
Thank you

@chmorgan
Copy link
Collaborator

Alright, took a look at the recv api. I'm not sure if/when I'd get to the changes but if this was implemented I think we'd want to do something like:

  • Add a new WinDivert specific GetNext() that takes in an array of 'out PacketCapture[] e' (if this is possible)
  • We need to have WinDivertDevice support an array of 'buffer's, likely with some dynamic allocation such that we allocate and grow them based on calls to GetNext() asking for multiple packets so we don't take up as much memory until the first call to get X packets, for example.
  • GetNext() would check to see how many entries were in the PacketCapture[] the array and call WinDivert to receive the min of e.length(), and the array of internal buffers.
  • And GetNext() would return the number of packets captured.

and of course we'd want to add a test to test the new method.

@trudyhood
Copy link
Author

I hope you make the changes. I should say congratulation for updating to version 6. It looks version 6 is 30% faster. Using batch mode with WinDivert increases the speed by more than 300%!
You can check the performance difference with windivert passthru.exe on a gigabit network.

passthru.exe [filter] [num-threads] [batch-size]
passthru.exe true 1 10

@kayoub5
Copy link
Collaborator

kayoub5 commented Sep 6, 2021

Keeping this open until WinDivertSendEx is supported as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants