Measure response time between website visitor and DO regions
I am building a Ruby on Rails application that lets users deploy a server in the DO region of their choice.
I’d like to show the latency between the user’s location and all the available DO regions so that the user can select the region with the fastest response time for them.
The latency can be easily calculated locally in development for each region with Net::Ping using the example code below:
check = Net::Ping::External.new(example_region_ip_address) start_time = Time.now check.ping? elapsed_time = ('%.6f' % (Time.now - start_time))
However, in production, the originating IP is consistently the web host of my application, not the user’s IP address.
How can I measure the response time between a website visitor and a DO region?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×