cperciva / ec2-boot-bench

Benchmark EC2 instance boot time from API call to accepting TCP connections
Other
35 stars 4 forks source link

Use private IPv4 address instead of an Elastic IP #7

Open wolruf opened 2 years ago

wolruf commented 2 years ago

I'll need to provide a patch but my C skills are rusty. To detect SSH socket being closed and open, an option to use the EC2 private IPv4 address instead of the Elastic IP (Public IPv4) can be used to reduce delays even further.

For now, I just modified main.c to use: ip = xmlextract(R->body, R->bodylen, "privateIpAddress"); instead of: ip = xmlextract(R->body, R->bodylen, "ipAddress");

cperciva commented 2 years ago

Good idea. I wasn't doing this because I was doing my initial testing from outside of EC2, but you're absolutely right that if we're testing from inside EC2 it makes sense to use the private address instead.

If you look at https://github.com/cperciva/ec2-boot-bench/commit/96b2e670a9d8be1c712427f62c55c126403d3b8e you'll see roughly what's necessary:

  1. Add a variable to record if we're using this option.
  2. Add a GETOPT_OPT which sets the variable to 1.
  3. Add it to usage().
  4. Change the IPv4 address extraction code to look for "privateIpAddress" if that variable is set.

If you're not comfortable writing the patch (I totally understand "I don't use this language often"! I say that a lot with Python code) I can put it together once I catch up with some other re:Invent-related work.