condemil / gist

Sublime Text plugin for creating new Gists from selected text
MIT License
725 stars 136 forks source link

Gist's requests take too much time respond on Ubuntu 12.04 #55

Closed fupslot closed 11 years ago

fupslot commented 12 years ago

Hello All.

I ran into an issue. On Ubuntu 12.04, Gist (the plugin) take to much time to respond. For example the command "Gist open" took 15 sec just to fetch the list of mine snippets and another 15 sec to fetch selected snippet, no matter what size of it 1kb or 100kb. That makes Gist almost useless to me, because it all about speed.

I blame the urllib2 python module, I believe I could :) Within the terminal a simple following command executes about 10-15 sec:

import urllib2 response = urllib2.urlopen("http://www.google.com") <-- this one

while an average ping to google.com is 150ms. Thus, I have a question to you All, is there any similar library like urllib2 that Gist can work with? Or maybe same settings have to be set up. Or maybe same request caching has to be turned on, or.. anything else that I can do to boost it? I'm not an expert in Python, but any direction would be appreciated.

BTW. In Windows environment Gist works from out of the box pretty fast. Thanks.

condemil commented 12 years ago

In Ubuntu we use cURL because Sublime Text 2 not includes ssl for urllib2 in Linux version:

api_request = api_request_curl if ('ssl' not in sys.modules and os.name != 'nt') else api_request_native
fupslot commented 12 years ago

Is that means that on Linux it would always work slow? Could be that module "SSL" be installed manualy?

condemil commented 12 years ago

No, before it was fine. Maybe gist api is working slowly for you now, try this command in Ubuntu Terminal and check does it download gists slowly or not.

wget https://api.github.com/gists

fupslot commented 12 years ago

Here is a log for that command you have posted above.

--2012-11-17 10:58:44-- https://api.github.com/gists Resolving api.github.com (api.github.com)... 207.97.227.243 Connecting to api.github.com (api.github.com)|207.97.227.243|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 56676 (55K) [application/json] Saving to: `gists'

100%[======================================>] 56,676 239K/s in 0.2s

2012-11-17 10:59:06 (239 KB/s) - `gists' saved [56676/56676]

22 sec. total. Most of that time is spending on to establish a connection by https protocol. Probably it is a reason why it works slow.

condemil commented 12 years ago

I don't know, why you have such issue with Ubuntu and HTTPS connections to GitHub API. You can try to ask this question on http://serverfault.com/ and https://github.com/contact

fupslot commented 12 years ago

As I understood so far, somehow it related to Ubuntu's issue of the slow DNS resolving. http://serverfault.com/questions/319644/host-resolution-extremely-slow-using-wget-on-local-dev-machine-fast-using-brows

Also, few people mentioned that it could be due to IP6 wich is enabled by default in Ubuntu. I turned it off, didn't help. Trying to find a fix solution...

condemil commented 11 years ago

You found the solution?

fupslot commented 11 years ago

No. I haven't found the solution. I kind of dealed with it. All I understood that it related to system's network configuration. But, if you have an idea how to fix it I will listern it with pleasure.

mkdizajn commented 11 years ago

I've got same issues as you guys.. here, this is mine timeing in console.. so baaaad :( 27sec

kreso@h17:~$ time wget https://api.github.com/gists
--2013-05-15 15:21:38--  https://api.github.com/gists
Resolving api.github.com (api.github.com)... 207.97.227.243
Connecting to api.github.com (api.github.com)|207.97.227.243|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 64669 (63K) [application/json]
Saving to: ‘gists.10’

100%[============================================================================================================================================================>] 64.669       214KB/s   in 0,3s   

2013-05-15 15:22:05 (214 KB/s) - ‘gists.10’ saved [64669/64669]

real    0m27.161s
user    0m0.004s
sys 0m0.008s

but the response time in chrome is similar to this 25sec.. I guess we can't get better response from this server, it's up gh slow delivery response .. right?

image

FLambert88 commented 11 years ago

Hi, I had the same time response problem on Ubuntu 12.10, i've fixed it by passing thrue a proxy on another computer (analogX proxy for Windows). What is surprising is that the same urllib2.urlopen.. works perfectly whell on win7

condemil commented 11 years ago

@fupslot @FLambert88 maybe DNS is working a bit slow on your machines. You can try Google Public DNS or PowerDNS DNS server that can be configured to send the requests to different DNS servers simultaneously and use first response.

mkdizajn commented 11 years ago

HAHAHA, this is crazy :)

this is my post from like year back... when I have configured google dns on my pc ,, but it's wrong!... whole this time??,, it's not 4444, its 8844,, I mean.. the second IP :)

look at my time now,, that's fast now! :)

kreso@h17:~$ time wget https://api.github.com/gists
--2013-08-26 22:40:19--  https://api.github.com/gists
Resolving api.github.com (api.github.com)... 192.30.252.137
Connecting to api.github.com (api.github.com)|192.30.252.137|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 62593 (61K) [application/json]
Saving to: ‘gists.1’

100%[============================================================================================================================================================>] 62.593       391KB/s   in 0,2s   

2013-08-26 22:40:20 (391 KB/s) - ‘gists.1’ saved [62593/62593]

real    0m1.204s
user    0m0.012s
sys 0m0.008s

little over 1sec! @condemil thanks for good tip and link in the right time.. (maybe Google only changed this second host ip,, ? who knows,, but now that speed issue is closed by me

condemil commented 11 years ago

@mkdizajn it was 8.8.4.4 as second IP from the beginning. You are welcome.