How to deal with the slow access speed of GitHub

Time:2019-10-21

githubIt is the most popular open source project hosting platform in the world. Its open source culture has fundamentally changed the way of software development.

Basically, all requirements can be met fromgithubMore or less to find a ready-made implementation, no longer need to start building wheels but custom wheels!

However, sometimes domestic visits to https://github.com/ are too slow. How to speed up the visitgithub.comWebsite became just need.

Becausegithub.comThe website is located in San Francisco, so the initial visitgithub.comNetwork addressing takes time, which is one of the reasons why websites open slowly.

Foreign online testing website: https://www.ipaddress.com/

Initial user input from browsergithub.comAt the time of web address, the browser does not know the reality of the domain name.ipAddress, first ask your computer if you know the number of the domain name. If you don’t know the local operator, you will continue to ask the superior until you know the name.github.comOur house number is192.30.253.113Until!

Such a tedious process of asking for directions is calledDNSAddressing, if the time of asking for directions takes a long time, then the speed of visiting the website will be very slow.

Therefore, if we directly tell the browser destination, the browser will not bother to ask the way step by step, which to some extent optimizes the speed of visiting the website.

$ ping github.com -c 3
PING github.com (192.30.253.113): 56 data bytes
64 bytes from 192.30.253.113: icmp_seq=0 ttl=41 time=405.924 ms
64 bytes from 192.30.253.113: icmp_seq=1 ttl=41 time=346.654 ms
64 bytes from 192.30.253.113: icmp_seq=2 ttl=41 time=345.485 ms

--- github.com ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 345.485/366.021/405.924/28.220 ms

ping github.com -c 3Seegithub.comThe house number of the website

Normally, there will be multiple subdomains under the main domain name of the website, which will be combined to provide complete services.

andgithub.comNo exception, includinggithub.comIt is a primary domain name and also a primary domain name. Other domain names are basically secondary Yu Min or sub domain names.

So we’re not just going to tell this machinegithub.comThe main domain name, but also the relevant sub domain name also tell this machine, help people to the end, send the blessing to the West!

Where can I find the domain name andipWhat about the corresponding relationship?

Think about real life, everyone has their own home, and this home has a specific address, which is usually called the house number.

Of course, some people have not only one home, but also many properties.

Corresponding to the computer world, domain name is the personal user in the computer, and the home of domain name is the IP address. A domain name can have multiple IPS, but an IP can only have one domain name.

The so-called “one mountain can’t allow two tigers” and “how can we let others sleep next to our couch”? There can only be one head of our family!

If someone wants to visit you, they must have a specific address to visit your home. The process from your home to your home address may be that you told him or that he himself sought information from others.

Domain name toipThe address process also needs to be inquired. This information usually exists.dnsService providers there, just like our address registered to the relevant government agencies.

Although the information of relevant organizations is authoritative and timely, the threshold is a little high. It’s better to ask the local “news link”.

On the Internet, “newscom” is more numerous, here recommend two query domain name resolution site.

  • https://www.ipaddress.com/

  • http://tool.chinaz.com/dns/

What are the subdomains

Below isipaddress.comFor example, querygithub.comInformation about the website.

Enter in the input boxgithub.comAfter the domain name, start to resolve the information related to the domain name, and not only find the correspondingipThe address also inquires the domain name information of the related website.

Experience it personally: domain name query

According to the relevant domain name information found, find out the correspondingipAddress, so sort out the following content.

# github related website
192.30.253.113 github.com
151.101.185.194 github.global.ssl.fastly.net
192.30.253.118 gist.github.com
192.30.253.120 codeload.github.com
185.199.108.153 desktop.github.com  
185.199.108.153 guides.github.com   
185.199.108.153 blog.github.com 
18.204.240.114 status.github.com   
185.199.108.153 developer.github.com    
185.199.108.153 services.github.com 
192.30.253.175 enterprise.github.com   
34.195.49.195 education.github.com    
185.199.108.153 pages.github.com    
34.196.237.103 classroom.github.com

Nearby CDN acceleration

Large web servers are not only one server, but a cluster of servers to provide services.

Used all over the worldgithubIf every time you visit the website, you go to the U.S. server. Even if the browser knows the destination, it will be very slow if it is too far away.

Therefore, if you can visit nearbygithubThe website can greatly improve the visiting speed. Fortunately, there are also ready-made tools on the Internet to help us check the nearest website address.

Experience it yourself: DNS query

From the above figure, we can see that there are many differences in the same domain name.ipAddress, select fromTTLThe minimum value is used as the optimization standard.

Therefore, the above list continues to be optimized as follows:

# github related website
192.30.253.113 github.com
151.101.185.194 github.global.ssl.fastly.net
203.98.7.65 gist.github.com
13.229.189.0 codeload.github.com
185.199.109.153 desktop.github.com 
185.199.108.153 guides.github.com  
185.199.108.153 blog.github.com
18.204.240.114 status.github.com
185.199.108.153 developer.github.com
185.199.108.153 services.github.com
192.30.253.175 enterprise.github.com   
34.195.49.195 education.github.com    
185.199.108.153 pages.github.com  
34.196.237.103 classroom.github.com

It’s best to test the nearest site in person for the best experience, but guess it’s not very different, so it’s OK to copy directly.

Tell local new address

Now we’ve figured out the domain name andipThe next thing we need to do is to tell the local computer that different operating systems may store different addresses for specific files.WindowsandMacGive an example.

# github related website
192.30.253.113 github.com
151.101.185.194 github.global.ssl.fastly.net
203.98.7.65 gist.github.com
13.229.189.0 codeload.github.com
185.199.109.153 desktop.github.com 
185.199.108.153 guides.github.com  
185.199.108.153 blog.github.com
18.204.240.114 status.github.com
185.199.108.153 developer.github.com
185.199.108.153 services.github.com
192.30.253.175 enterprise.github.com   
34.195.49.195 education.github.com    
185.199.108.153 pages.github.com  
34.196.237.103 classroom.github.com

windows

The mapping file is stored in:C:\Windows\System32\drivers\etc\hosts

  • openhostsFile, mapping the aboveAppendTo the end of the file, save and exit.

If you are unable to save due to insufficient permissions, you can copy to the desktop, edit the file, move and replace it tohostsDocuments.

  • Functionipconfig /flushdnsRefreshdnsCache.

mac

The mapping file is stored in:/etc/hosts

  • edithostsFile and append the above mapping relationship.
$ cat /etc/hosts
# jetbrains
0.0.0.0 account.jetbrains.com
0.0.0.0 www.jetbrains.com

# github related website
192.30.253.113 github.com
151.101.185.194 github.global.ssl.fastly.net
203.98.7.65 gist.github.com
13.229.189.0 codeload.github.com
185.199.109.153 desktop.github.com 
185.199.108.153 guides.github.com  
185.199.108.153 blog.github.com
18.204.240.114 status.github.com
185.199.108.153 developer.github.com
185.199.108.153 services.github.com
192.30.253.175 enterprise.github.com   
34.195.49.195 education.github.com    
185.199.108.153 pages.github.com  
34.196.237.103 classroom.github.com
  • Functionsudo dscacheutil -flushcacheRefreshdnsCache.
$ ping github.com -c 3
PING github.com (192.30.253.113): 56 data bytes
64 bytes from 192.30.253.113: icmp_seq=0 ttl=41 time=395.808 ms
64 bytes from 192.30.253.113: icmp_seq=1 ttl=41 time=306.919 ms
64 bytes from 192.30.253.113: icmp_seq=2 ttl=41 time=298.188 ms

--- github.com ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 298.188/333.638/395.808/44.105 ms
$ 

Time to summarize

This article describes how to solvegithub.comThe problem of slow access to the website can be solved by modifying thehostsFile to bypassdnsParsing, this method is only applicable to the phenomenon that it is only slow to visit the website.

If you can’t access foreign websites, this method is not applicable, and you may need to find another way!

Recommended Today

How to check the package according to the command in CentOS

In our work, we often encounter that we want to use a command machine that is not installed, but we don’t know which package the command is in (source compilation is not covered in this article). Here is a rather stupid method to help us solve this problem. Explain:Blue = command name Light green = […]