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

Things to optimize - performance #539

Closed
deputinizer opened this issue May 8, 2022 · 10 comments
Closed

Things to optimize - performance #539

deputinizer opened this issue May 8, 2022 · 10 comments

Comments

@deputinizer
Copy link
Contributor

deputinizer commented May 8, 2022

  • utils.Decode
  • templates.Parse
  • job.getNextPacket
[Spoiler] pprof CPU

image

image

image

image

@arriven
Copy link
Owner

arriven commented May 8, 2022

for getNextPacket: have you tried setting StaticPacket to true in the config? should work on tcp/udp jobs as well as they just forward that argument to packetgen

@deputinizer
Copy link
Contributor Author

@arriven
Copy link
Owner

arriven commented May 8, 2022

I'm not sure you can optimize other two without defeating their purpose completely. The only other thing that could be done is porting that StaticPacket thing to http flood to enable sending more traffic when no variablility is needed

@deputinizer
Copy link
Contributor Author

Well there should be something faster, maybe:

  • just pure function and arg (random_payload 10)
  • JIT - just in time compiled template? Is there anything in go?

@deputinizer
Copy link
Contributor Author

Because compiling config is a no-go? 😋
https://github.com/valyala/quicktemplate

@arriven
Copy link
Owner

arriven commented May 8, 2022

pure function and arg could work, but it would make the config even more bloated and I'm not completely sure it would be much faster, especially compared to static version which parses templates only once when new config is received. Also current implementation is already not that bad - in go you have separate Parse and Execute functions for templates where Parse takes significantly more resources than Execute. I don't think it's the most effective implementation but it does its job quite well

@arriven
Copy link
Owner

arriven commented May 8, 2022

There's no StaticPacket there

Yeah, updating all the admin processes takes some time

@deputinizer
Copy link
Contributor Author

Nice, you added static :)

[Spoiler] Here's dynamic

image

@arriven
Copy link
Owner

arriven commented May 8, 2022

hmm, having thought about it more, with current usage it might be easier to switch the code to use static by default and dynamic would have to be specified explicitly

@arriven
Copy link
Owner

arriven commented May 8, 2022

it won't affect memory usage but the CPU profile should get a lot better

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

No branches or pull requests

2 participants