Internet transfer taking ages for elastic beanstalk environment, with traceroute showing strange output - amazon-elastic-beanstalk

I have an EBS environment set up in AWS us-east-1, and I'm calling it from Australia via http. There is a DNS set up in front of it on route 53, and I'm calling it via that. I'm aware that having the infra in us-east-1 should add some latency impact in terms of the internet speed.
However, the latency increase seems to be way more than normal. My analysis has shown that it takes 200ms for the endpoint to return a response, the response being 6000 characters of text, but then 900ms end-to-end for the data to hit my computer. That means the data transfer time over the internet is taking 700ms.
This latency is much less (about 100ms for data transfer) if i return for example just 20 characters. I've tried other endpoints in us-east-1 and they transfer the data a lot faster, so my internet connection is unlikely to be the issue. I tried doing a traceroute and here was the output. I'm not skilled at reading traceroute so im not sure if this is misconfigured:
1 mymodem (192.168.0.1) 5.515 ms 4.140 ms 4.416 ms
2 gateway.vb09.melbourne.asp.telstra.net (58.162.26.201) 13.920 ms 18.528 ms 14.207 ms
3 ae10.lon-ice301.melbourne.telstra.net (203.50.61.129) 15.245 ms
ae10.win-ice301.melbourne.telstra.net (203.50.61.145) 14.800 ms 13.342 ms
4 bundle-ether25.exi-core30.melbourne.telstra.net (203.50.61.128) 15.015 ms 15.545 ms
bundle-ether25.win-core10.melbourne.telstra.net (203.50.61.144) 15.603 ms
5 bundle-ether2.cla-core30.melbourne.telstra.net (203.50.13.124) 15.580 ms 15.727 ms 15.234 ms
6 bundle-ether19.chw-core10.sydney.telstra.net (203.50.13.144) 26.375 ms
bundle-ether3.hay-core30.sydney.telstra.net (203.50.13.132) 26.279 ms 27.283 ms
7 bundle-ether1.oxf-gw11.sydney.telstra.net (203.50.6.93) 25.961 ms
bundle-ether19.ken-core10.sydney.telstra.net (203.50.13.146) 26.221 ms 26.505 ms
8 203.50.13.98 (203.50.13.98) 27.733 ms
bundle-ether1.pad-gw11.sydney.telstra.net (203.50.6.61) 26.582 ms
203.50.13.98 (203.50.13.98) 26.650 ms
9 203.50.13.98 (203.50.13.98) 180.096 ms
203.50.13.90 (203.50.13.90) 26.194 ms 27.483 ms
10 203.50.13.90 (203.50.13.90) 165.233 ms 162.661 ms 163.185 ms
11 i-73.paix-core02.telstraglobal.net (202.84.247.45) 185.490 ms 181.710 ms 179.565 ms
12 i-92.paix02.telstraglobal.net (202.84.247.41) 180.893 ms
i-92.eqnx03.telstraglobal.net (202.84.247.17) 160.601 ms 161.498 ms
13 gtt-peer.paix02.pr.telstraglobal.net (134.159.61.98) 327.221 ms 183.915 ms
64.86.160.0 (64.86.160.0) 163.227 ms
14 ae11.cr7-dal3.ip4.gtt.net (213.200.115.26) 240.476 ms
ae12.cr7-dal3.ip4.gtt.net (213.200.120.106) 242.111 ms
64.86.160.5 (64.86.160.5) 220.202 ms
15 ip4.gtt.net (209.120.154.162) 213.780 ms 293.630 ms 308.845 ms
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
31 * * *
32 * * *
33 * * *
34 * * *
35 * * *
36 * * *
37 * * *
38 * * *
39 * * *
40 * * *
41 * * *
42 * * *
43 * * *
44 * * *
45 * * *
46 * * *
47 * * *
48 * * *
49 * * *
50 * * *
51 * * *
52 * * *
53 * * *
54 * * *
55 * * *
56 * * *
57 * * *
58 * * *
59 * * *
60 * * *
61 * * *
62 * * *
63 * * *
64 * * *
I also tried pinging the endpoint and got the following
.Request timeout for icmp_seq 240
If anyone could let me know if this is misconfigured or point me to what I should test/analyse to improve the data transfer latency that would be so useful.

There are indeed disturbingly many hops within Telstra's network! But Internet was designed to be resilient, rather than efficient.
AWS offers more optimal routing through its own private network with Global Accelerator, if your use case calls for a global service out of a single AWS region. Otherwise it may be cheaper to run replication across several AWS regions close to your users, and there are quite a few possible architectures with different tradeoffs between latency and cost, which will have to be considered in the context of your specific application.
Finally, to let the ping through to your instance, you will need to enable inbound rule for Custom ICMP - IPv4 traffic in your security group.

Related

MySQL - MOD() return 1 instead of 0

I have the following MySQL code that according to me should return 0:
mod( mod((180 / (30.4166666667 * 24 * 60)),1) * 30.4166666667,1) * 24 as HoursWorked
=> return 3.000
mod(mod(mod((180 / (30.4166666667 * 24 * 60)),1) * 30.4166666667,1) * 24,1) as ModHoursWorked
=> return 1
What am I missing?
the division must be floored
select mod(mod(mod(( floor(180 / (30.4166666667 * 24 * 60)) ),1) * 30.4166666667,1) * 24,1) ;
This worked:
SELECT truncate(mod(mod(mod((180 / (30.4166666667 * 24 * 60)),1) * 30.4166666667, 1) * 24, 1), 0) AS ModHoursWorked; => return 0

Problems to connect SSH with Google's VPC

I can't to connect by SSH with Google's VPC from my home, but I get to connect from my Public University.
I'm discarding this points:
Problems with SSH, becausa i don't have problems to connect with another computer by ssh.
I'm sure the problem is not SSH Key, because I get to connect from my Public University.
What did i do?
I checked if the problem is Firewall, but I believe it's not that problem. See below the Firewall rule on VPC Google's:
myrule apply to all Intervalos de IP: 192.168.0.0/24 tcp:22 Allow 1000 default
I did test the Ping. I did see that it's working.
PING 35.198.21.159 (35.198.21.159) 56(84) bytes of data.
64 bytes from 35.198.21.159: icmp_seq=1 ttl=61 time=24.6 ms
64 bytes from 35.198.21.159: icmp_seq=2 ttl=61 time=29.0 ms
64 bytes from 35.198.21.159: icmp_seq=3 ttl=61 time=26.0 ms
64 bytes from 35.198.21.159: icmp_seq=4 ttl=61 time=27.4 ms
^C
--- 35.198.21.159 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 24.623/26.773/29.024/1.645 ms
Looking the tracerout, i can see that the final point is not VPC's IP.
traceroute to 35.198.21.159 (35.198.21.159), 30 hops max, 60 byte packets
1 192.168.0.1 2.457 ms 3.457 ms 11.818 ms
2 * * *
3 187.122.188.1 14.157 ms 14.139 ms 14.496 ms
4 200.167.43.21 23.555 ms 23.515 ms 23.476 ms
5 200.244.216.46 22.159 ms 22.142 ms 23.242 ms
6 200.244.216.167 19.398 ms 22.508 ms 22.752 ms
7 201.73.52.38 12.922 ms 14.935 ms 16.819 ms
8 108.170.251.66 14.762 ms 108.170.251.67 11.887 ms 13.945 ms
9 209.85.245.50 29.488 ms 209.85.245.52 21.016 ms 216.239.43.16 19.189 ms
10 108.170.245.129 30.328 ms 108.170.245.225 28.877 ms 28.251 ms
11 72.14.232.163 27.519 ms 108.170.225.26 28.256 ms 209.85.247.47 29.109 ms
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
For all that, can someone help me?

Website loading issue in all browsers on DSL Connection

I am running ubuntu 14.04 and i am using a DSL Connection.From last few days i am having problem in loading some websites like ubuntuforums, hackerrank, mdn etc. I have tried alsmost all solutions available on internet. I am only having this problem on dsl connection. On wifi everything works fine.
1) I have changed default dns to google public dns.
2) This is the outcome of my traceroute ubuntuforums.org
SinScary "at" avenger:~:$traceroute ubuntuforums.org
traceroute to ubuntuforums.org (91.189.94.12), 30 hops max, 60 byte packets
1 100.65.128.1 (100.65.128.1) 0.943 ms 0.916 ms 0.578 ms
2 * * *
3 172.31.210.158 (172.31.210.158) 1.657 ms 1.649 ms 1.634 ms
4 172.31.10.73 (172.31.10.73) 1.950 ms 1.901 ms 1.881 ms
5 10.0.248.2 (10.0.248.2) 2.134 ms 2.126 ms 2.225 ms
6 ws86-230-252-122.rcil.gov.in (122.252.230.86) 1.834 ms 1.372 ms 1.891 ms
7 ws85-230-252-122.rcil.gov.in (122.252.230.85) 1.716 ms 1.830 ms 1.900 ms
8 172.31.210.42 (172.31.210.42) 2.193 ms 2.184 ms 2.231 ms
9 172.31.10.66 (172.31.10.66) 39.689 ms 39.668 ms 39.665 ms
10 172.31.10.198 (172.31.10.198) 2.109 ms 2.163 ms 2.093 ms
11 aes-static-113.195.22.125.airtel.in (125.22.195.113) 1.898 ms 1.863 ms 2.436 ms
12 182.79.245.141 (182.79.245.141) 214.911 ms 182.79.222.109 (182.79.222.109) 220.000 ms *
13 * * *
14 ae-126-3512.edge5.london1.Level3.net (4.69.166.45) 151.005 ms ae-123-3509.edge5.London1.Level3.net (4.69.166.33) 149.374 ms 141.512 ms
15 SOURCE-MANA.edge5.London1.Level3.net (212.187.138.82) 195.375 ms 159.963 ms 160.023 ms
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
3) I have disabled ipv6 as suggested in this Answer by Mitch
4) It successfully pinging from ubuntuforums.org, hackerrank.com
5) Appended nameserver 8.8.8.8 to /etc/resolve.conf
6) Reinstalled Chrome
7) Also tried the following commands
sudo apt-get install resolvconf
sudo dpkg-reconfigure resolvconf
8) Tried disabling dns masq
9) This is the output of route -n
SinScary "at" avenger:~:$route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 100.65.128.1 0.0.0.0 UG 0 0 0 ppp0
100.65.128.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
SinScary "at" avenger:~:$
10) This is the output of cat /etc/hosts
SinScary "at" avenger:~:$cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 avenger
127.0.0.2 sinscary.com sinscary
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
SinScary "at" avenger:~:$
This is the error i am getting while loading websites
ERR Timed Out
Any Help with this.

Posting recursive ajax call data on HTML(Angularjs)

I am doing recursive ajax call and receiving server data. For each call, I receive some chunk of data. I want to show up that data on the front end. How do I do so that each received part of data is one below another. I hope this is clear.
for example
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
Suppose I received first 10 lines on first ajax call, next 5 in next and so on, I want to show up as it is shown above, without wiping out first received data and showing 2nd received data. By the way I am using Angularjs for front end.
Added code snippet on Gaurav request.
callOnReq(requestId);
function callOnReq(requestId) {
console.log('Request ID sent')
$http.post('/py/recvData',{'requestId':requestId}).
success(function(data, status, headers, config) {
console.log('Data after request ID')
$scope.recdData data.output;
if (data.output != ""){
callOnReq(requestId);
}else if (data.output == ""){
console.log('Data receiving over');
}
}).
error(function(data, status, headers, config) {
console.log(status);
});
};
Thanks in advance.
Declare a variable in scope.
$scope.responseList=[];
Then push the response text in that
If response data is list then you have to concate it
$scope.responseList=$scope.responseList.concat(data);
If response data single objecth then you have to push it
$scope.responseList.push(data);
Sample code
$http({
// code
}).then(function(result){
// data is list then you have to concate it
$scope.responseList=$scope.responseList.concat(data);
// data is single objecth then you have to push it
$scope.responseList.push(data);
})
Then display responseList in the view.

Null returns for distance

Total SQL newb here. I've created two SQL tables, one containing information about hotels and the other containing information about attractions. I'm trying to create a query where I can input a postcode of an attraction, and have the database return the distance of hotels within a 1, 5 and 10 mile radius.
SELECT
hotels.*,
attractions.*,
( ( ACOS( SIN(hotels.Hotel_Lat * PI() / 180)
* SIN(attractions.Attraction_Lat * PI() / 180)
+
COS(hotels.Hotel_Long * PI() / 180)
* COS(attractions.Attraction_Long * PI() / 180)
* COS((hotels.Hotel_Long - attractions.Attraction_Long) * PI() / 180)
) * 180 / PI()
) * 60 * 1.1515
) as distance
FROM hotels
JOIN attractions
This query returns 'Null' for distances. My tables are populated with lat longs as well as postcodes. Any ideas why please? I have negative value longitudes if that makes a difference?
Using MySQL Community server 5.6.17.
Sample Data - There are 7 rows of data in hotels.
Hotel_Name | Hotel_Address | Hotel_Lat | Hotel_Long
a ST158DH 52.906438 -2.145523
b ST161LF 52.827959 -2.129709
Attraction_Name | Attraction_Postcode | Attraction_Lat | Attraction_Long
a ST180BA 52.839509 -2.056964
b ST180TG 52.832820 -2.091124
There are four attractions in total.
Using the Haversine formula, which is well behaved even at very small distances, try this code (or equivalent for MySQL):
select
Hotel_Name
,Hotel_Address
,Attraction_Name
,Attraction_Address
,round(2 * atn2(sqrt(a),sqrt(1-a)), 4) as DeltaRad
,round(2 * atn2(sqrt(a),sqrt(1-a)) * (180.0 / pi()), 2) as DeltaDeg
,round(2 * atn2(sqrt(a),sqrt(1-a)) * (180.0 / pi()) * 60, 2) as DeltaNMs
,round(2 * atn2(sqrt(a),sqrt(1-a)) * 6371.0, 2) as DeltaKMs
from (
select
Hotel_Name
,Hotel_Address
,Attraction_Name
,Attraction_Address
, SinHalfDeltaLatRad * SinHalfDeltaLatRad
+ CosCosLat
* SinHalfDeltaLngRad * SinHalfDeltaLngRad as a
from (
SELECT
Hotel_Name
,Hotel_Address
,Attraction_Name
,Attraction_Address
,sin((h.Lat - a.Lat) * PI() / 180.0 / 2.0) as SinHalfDeltaLatRad
,sin((h.Lng - a.Lng) * PI() / 180.0 / 2.0) as SinHalfDeltaLngRad
,cos(a.Lat) * cos(a.Lat) as CosCosLat
FROM hotels as h
cross JOIN attractions as a
) t
) t
Yielding for your sample data:
Hotel_Name Hotel_Address Attraction_Name Attraction_Address DeltaRad DeltaDeg DeltaNMs DeltaKMs
-------------------- ------------- -------------------- ------------------ ---------------------- ---------------------- ---------------------- ----------------------
HotelA ST158DH AttractionA ST180BA 0.0018 0.1 6.02 11.15
HotelB ST161LF AttractionA ST180BA 0.0011 0.06 3.75 6.94
HotelA ST158DH AttractionB ST180TG 0.0015 0.09 5.2 9.63
HotelB ST161LF AttractionB ST180TG 0.0006 0.03 1.97 3.64