10 second delay before POST scan due to ipv6 (Ubuntu)

NOTE. I do not want to delete any of the information below, but when I thought it was Heroku's problem, it wasn’t. I think this is a problem with my local machine sending messages via curl and ruby ​​Net :: HTTP

I am currently starting to work on the rails application on Heroku (for free), and in order to get some test data in the application, I have a rake task that takes test data from my DEV database and sends messages to the JSON REST API in heroku app:

uri = URI.parse("http://SITENAME.herokuapp.com")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new("/users.json")
request.add_field('Content-Type', 'application/json')
request.body = {'user' => User.first.to_hash }.to_json
response = http.request(request)

For some reason, each request takes almost exactly 10 seconds. Then I changed the top line to:

uri = URI.parse("http://localhost:3000")

... and requests are incredibly fast. Does anyone know if Heroku POSTS slows down the free version? (that would be wise, since they want you to pay for a working dino). In the end, I'm going to talk about the paid version, but I want to do a little more in my DEV before doing this. Also, if they are not deliberately slowing them down, I’m a little hesitant to use them until I find out why messages take so long. A line that takes 10 seconds:

response = http.request(request)

I am sure this was obvious, but I decided that I had mentioned it.

UPDATE 3/12 I just want to publish some of my magazines from today. All requests take 10 seconds:

1400
Before: 2013-03-12 21:30:33 UTC
After: 2013-03-12 21:30:43 UTC
1401
Before: 2013-03-12 21:30:43 UTC
After: 2013-03-12 21:30:54 UTC
1402
Before: 2013-03-12 21:30:54 UTC
After: 2013-03-12 21:31:04 UTC
1403
Before: 2013-03-12 21:31:04 UTC
After: 2013-03-12 21:31:14 UTC
1404
Before: 2013-03-12 21:31:14 UTC
After: 2013-03-12 21:31:24 UTC
1405
Before: 2013-03-12 21:31:24 UTC
After: 2013-03-12 21:31:34 UTC

3/15 , Net:: HTTP:: Post, , , , curl, 10 :

curl -X POST -H "Content-type: application/json" -d {"params":{"q":"query"} http://SITENAME.herokuapp.com/users.json

- heroku, ( new_relic), , ?

3/15 # 2 Heroku 10- Ruby Net:: HTTP:: Post . localhost, .

3/28

, heroku :

2013-03-29T03:22:06+00:00 app[web.1]: Started POST "/user.json" for IP
2013-03-29T03:22:06+00:00 app[web.1]:   Parameters: {"user"=>{data}}
2013-03-29T03:22:06+00:00 app[web.1]: Processing by UserController#create as JSON
2013-03-29T03:22:06+00:00 app[web.1]:   User Load (2.2ms)  <<<SQL>>>
2013-03-29T03:22:06+00:00 app[web.1]: Completed 200 OK in 3ms (Views: 0.1ms | ActiveRecord: 2.2ms)
2013-03-29T03:22:06+00:00 heroku[router]: at=info method=POST path=/users.json host=HOST.herokuapp.com fwd="66.31.201.99" dyno=web.1 connect=2ms service=33ms status=200 bytes=16
2013-03-29T03:22:16+00:00 app[web.1]: Started POST "/users.json" for 66.31.201.99 at 2013-03-29 03:22:16 +0000
2013-03-29T03:22:16+00:00 app[web.1]: Processing by UserController#create as JSON
2013-03-29T03:22:16+00:00 heroku[router]: at=info method=POST path=/users.json host=HOST.herokuapp.com fwd="66.31.201.99" dyno=web.1 connect=8ms service=19ms status=200 bytes=16
2013-03-29T03:22:16+00:00 app[web.1]:   Parameters: Parameters: {"user"=>{data}}
2013-03-29T03:22:16+00:00 app[web.1]:   User Load (2.0ms)  SQL
2013-03-29T03:22:16+00:00 app[web.1]: Completed 200 OK in 3ms (Views: 0.1ms | ActiveRecord: 2.0ms)

3/28 # 2

-: www.compileonline.com/execute_bash_online.php, , , - . - , , . , 10 , -:

curl -X POST -H "Content-type: application/json" -d '{"user":"payload"}' http://APP.herokuapp.com/users.json

3/28 # 3

- . , , , 10- , :

date +"%T" && curl -X POST -H "Content-type: application/json" -d '{"user":"payload"}' http://APP.herokuapp.com/users.json -v --trace-time -S

... ...

00:44:16  [start time from date +"%T"]
00:44:26.653510 * About to connect() to APP.herokuapp.com port 80 (#0)
00:44:26.653632 *   Trying 184.72.248.52... connected
00:44:26.675676 > POST /users.json HTTP/1.1
00:44:26.675676 > User-Agent: curl/7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
00:44:26.675676 > Host: APP.herokuapp.com
00:44:26.675676 > Accept: */*
00:44:26.675676 > Content-type: application/json
00:44:26.675676 > Content-Length: 653
00:44:26.675676 > 
00:44:26.675954 * upload completely sent off: 653out of 653 bytes
00:44:26.717286 < HTTP/1.1 200 OK
00:44:26.717380 < Cache-Control: max-age=0, private, must-revalidate
00:44:26.717518 < Content-Type: application/json; charset=utf-8
00:44:26.717552 < Date: Fri, 29 Mar 2013 04:44:33 GMT
00:44:26.717584 < Etag: "7363e85fe9edee6f053a4b319588c086"
00:44:26.717616 < Status: 200 OK
00:44:26.717647 < X-Rack-Cache: invalidate, pass
00:44:26.717678 < X-Request-Id: 19ff002048e4e2d5e17a8203576a4194
00:44:26.717708 < X-Runtime: 0.008901
00:44:26.717739 < X-Ua-Compatible: IE=Edge,chrome=1
00:44:26.717771 < transfer-encoding: chunked
00:44:26.717802 < Connection: keep-alive
00:44:26.717832 < 
00:44:26.717925 * Connection #0 to host APP.herokuapp.com left intact
00:44:26.717998 * Closing connection #0

10- connect(). , , host APP.herokuapp.com , .

3/28 # 4

, -4, ipv4, :

date +"%T" && curl -4 -X POST -H "Content-type: application/json" -d '{"user":"payload"}' http://APP.herokuapp.com/users.json -v --trace-time -S

ipv6 , http://www.upubuntu.com/2011/05/how-to-disable-ipv6-under-ubuntu.html, . , , , - Net:: HTTP HTTParty, IPv6 , .

+5
1

Heroku , ? , Heroku ( dev production) . , 10 , - ?

, , , . , , 200 . , , . , , .

0

All Articles