Thursday 15 May 2014

networking - Find bottleneck of flask application -


I wrote a flask application. I am very slow when I put it in a remote server. So, I did some profiling practices with it. Please take a look at the pictures given below:

The profile I am using is:

  #coding: werkzeug.contrib.profiler import from utf- 8 ape Profailrveyr import applications app.config [ 'personality'] = true app.wsgi_app = ProfilerMiddleware (app.wsgi_app, restrictions = [30]) app.run (debug = true)   

Figure 1

The configuration in the Remote Server might be interrupted _socket.getaddrinfo

 Enter image details here

image 2

Local machine variations Eat

Enter image details here

Image 3

sometimes ¼ ?? Even in remote servers, no obstacles are found. No _socket.getaddrinfo found odd! Enter image details here

I also profiled in the remote server Python shell, along with Only cProfile . Take a look at this:

  in [10]: cProfile.run ( "socket.getaddrinfo ( 'easylib.gdufslib.org', 80, 0, 0, socket.SOL_TCP)") 3 function calls ordered by 8.014 seconds CPU: standard name ncalls tottime percall cumtime percall filename: lineno (function) 1 0,000 0,000 8,014 8,014: 1 () 1 8,014 8,014 8,014 8,014 {_socket.getaddrinfo} 1 0.000 0.000 0.000 0.000 { Law '_lsprof.Profiler' to 'disable' goods} [11]: cProfile.run ( "socket.getaddrinfo ( 'easylib.gdufslib.org', 80, 0, 0, socket.SOL_TCP)") 3 function 8.009 Call in CPU standard name ncalls tottime percall cumtime percall filename: ordered second lineno (function) 1 0,000 0,000 8,009 8,009: 1 () 1 8009 8 , 009 8,009 8,009 '_lsprof {_socket.getaddrinfo} 1 0.000 0.000 0.000 0.000 {Method' Unable '. Profiler 'objects}   

There is probably a fact that some DNS resolution takes longer to work, and I can not convert it myself.

Can anyone tell me why: _socket.getaddrinfo is CL's leadership and why not sometimes called? How is _socket.getaddrinfo being called? Because this is slow down my website which frustrates me.

I just ran myself on a flask running on a dedicated box from the edition digital ocean , So I will post in the solution if someone else in the future is a hit.

I saw that a few days ago that Guit Hub's API requests were insanely slow, sometimes between 10 to 20 seconds, but locally my app There was no problem running. I have my app profiles, and socket.getaddrinfo was the culprit:

  1 15058.431 15058.4310 15058.431 15058.4310 {_socket.getaddrinfo} 1 26.545 26.5450 26.545 26.5450 {_ssl.sslwrap } 1 23.246 23.2460 23.246 23.2460 {manufactured method do_handshake} 4 22.387 5.5968 22.387 5.5968 {manufactured method read} 1 7.632 7.6320 7.632 7.6320 {method '_socket.socket' to 'connect' goods} 103 4.995 0.0485 7.131 0.0692 & LT; S / WERKZEUG / urls.py: 374 (url_quote) & gt; 2 2.459 1.2295 2.578 1.2890 & lt; Ssl.py: 294 (close) & gt; 36 1.4 9 5 0.0415 10.548 0.2 9 30 & lt; S / werkzeug / routing.py: 707 (build) & gt; 859 1.442 0.0017 1.693 0.0020 {isinstance} .... etc.   

Working with digital ocean support, and suspect it was somehow a DNS issue, to change the work solution Nameserver 4.2.2.2 Nameswar 8.8.8.8

 / Code> Code> Namesworth 8.8.4.4 Nameswar 8.8.8.8   

For whatever reason, 4.2.2.2 (run by Level 3) decided that It hates me, but it takes me time and Google's DNS is quieting

UPDATE: My cooperation Mr. Karl suggested I go ahead and set up a local DNS caching server with the tie to prevent Google's DNS from hitting me as well.

No comments:

Post a Comment