私のアプリでは、次のように外部サーバーに複数のリクエストを行いますか?
req = Curl::Easy.new do |curl|
curl.url = "https://www.mysite.com"
curl.headers['Content-type'] = 'application/json'
end
req.perform
応答時間 (要求にかかる時間) を取得できますか?
機能していると思われる解決策は次のとおりです (疑似コード) が、もっと洗練されたものがありますか?
req = Curl::Easy.new do |curl|
curl.url = "https://www.mysite.com"
curl.headers['Content-type'] = 'application/json'
end
timeBefore = Time.now
req.perform
timeAfter = Time.now
responseTime = timeAfter - timeBefore