arriven/db1000n

Things to optimize - performance

deputinizer opened this issue ยท 10 comments

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

image

image

image

image

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

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

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?

Because compiling config is a no-go? ๐Ÿ˜‹
https://github.com/valyala/quicktemplate

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

There's no StaticPacket there

Yeah, updating all the admin processes takes some time

Nice, you added static :)

[Spoiler] Here's dynamic

image

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

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