So you want your app/website to work in China
chanind.github.io
chanind.github.io
- Stop using Google CDNs
- Stop using Google fonts
- Don't put Google Analytics in the header (or don't use it) otherwise will block/delay the browser load the website.
Most of the websites just timeout because of those 3 things and make the website imposible to navigate.
If you host your website in a normal VPS, without using Google services you will have a quite nice chance that the website loads pretty fast there in China.
edit: formatting
Will have to double check...
Sometimes there wouldn’t even be UI that would load to indicate something was wrong. Logins would just fail with cryptic messages.
I think we can avoid Google font CDNs for fonts but we can use them from our assets i.e download the font and use it from your assets instead of Google CDN.
PS: VPN is a blocked keyword, so we say "use internet scientifically"
I know some enterprise environments are, not surprisingly, not too fond of 3rd-party scripts, and their firewalls could be nearly as bad too.
Stackoverflow use Google CDN. The one to be blamed is the chinese GFW. but it will be much better if they do not use google service. Maybe they do not bother to serve user in china.
* I've been hosting my Chinese blog in US vps since 2009 and it works fine.
* I have Gitea hosted in US vps and it works fine too.
* GoDaddy has Alipay (sort of China's PayPal) up for a long time.
* ICP Licenses are easy to get (at least for Chinese) and typically take less a month. I've done it for my company's websites and my clients' websites.
* ICP licenses are required only if you want to host your website in China. Hosting in China is ridiculously expensive and many Chinese go out of their way to host elsewhere. For 9$ a month you get 1 cpu, 1G ram and 1MBit bandwidth, which translates to 128kb/s.
To make your website load, and load fast in China:
* Remove Google fonts, Google cdn, resources from FB, twitter, etc. this should fix 95% of your problem.
* Avoid well-known host providers (AWS, Vultr, Linode) if you can, they tend to get banned.
* Get a host with CN2. I heard hosting in Hong Kong is fast too. It's only necessary if you really want your site to be lightning fast. As a Chinese, if I'm visiting your website and your website is in English, then I probably expect it to be slow, so...
Tested Alibaba Cloud in honkers from Shenzhen and Guangzhou late last year for a couple weeks as a Shadow Socks host. Worked really well, <10milsec ping.
That said, its not day to day that i've had probs with Honker <~> Mainland traffic. It's the seemingly random network performance degradation that bites.
If I host in Europe or US would the speed of traffic going into China be very slow?
If I get a 1Gbps server in EU most likely I can serve 1Gbps to USA. Will I be able to serve 1Gbps to China from that EU server?
> For 9$ a month you get 1 cpu, 1G ram and 1MBit bandwidth
That is insanely expensive. How can startups in China handle that kind of hosting cost? Where do they host their websites?
> Get a host with CN2
What's CN2? Where can I find their website?
I'm not sure, but I guess it should be nowhere near 1Gbps. You'll have to test it to find out.
> How can startups in China handle that kind of hosting cost?
It's mainly bandwidth that's expensive, but there is cheap cdn/cloud storage for static files, like videos. Then you can also pay by traffic, which is around $0.12/Gb.
> If I host in Europe or US would the speed of traffic going into China be very slow? ... Will I be able to serve 1Gbps to China from that EU server?
Not sure about 1Gbps, but I've seen my 200Mbps band basically saturated. It's rather spotty though -- definitely not 200Mbps all the time. Latency is a very big problem here, so make sure you do TCP tuning right; without TCP tuning you might see awful speeds.
> That is insanely expensive. How can startups in China handle that kind of hosting cost? Where do they host their websites?
The insanely expensive part is bandwidth. For instance with Alibaba Cloud, a 1 vCPU, 1G RAM, 20G SSD instance with pay-as-you-go network billing is like $6/mo so it's not that bad, and there are promotions year round so if you're committed for say one year at a time you can usually get it for maybe half the list price, but outbound bandwidth is a whopping $0.123/GB (which is actually not that different from AWS/GCP's Asia pricing).
I don't know about startups but I suppose it's fine if you host static assets through a CDN and only use the expensive bandwidth from compute for truly dynamic content.
Any suggestions on how to tune TCP for this situation?
> I suppose it's fine if you host static assets through a CDN and only use the expensive bandwidth from compute for truly dynamic content.
Wouldn't the bandwidth cost of CDN be even higher than that of Alibaba Cloud?
Roughly speaking, TCP throughput is window size / latency, and the default window size on Linux is usually pretty small, so for high latency connections (US to CN roundtrip is usually several hundred ms) the throughput would be bad. Increasing TCP buffer sizes goes a long way. In addition to buffer sizes, finer tuning is possible via other options/parameters; just find a guide online, there are plenty.
> Wouldn't the bandwidth cost of CDN be even higher than that of Alibaba Cloud?
Hmm, shouldn't CDNs for static assets be cheaper than bandwidth associated with compute instances in general? For instance, Alibaba Cloud's CDN offering starts at $0.04/GB (in Mainland China) for the first 50TB, and gradually decreases from there.[1]
Some vps providers buy these fast lanes, make their vps fast to access in China, and sell them to hungry Chinese users. The most popular one is Bandwagon[2].
[0] https://www.ctamericas.com/products-services/internet/global...
[1] https://www.ctamericas.com/products-services/internet/global...
There are sites for testing what is blocked in China - you should test all 3rd party scripts you are using to make sure they run ok.
Anyway, before I had a stable proxy, I actually set up my local DNS to redirect all .google.com., .facebook.com. and their CDNs to 127.0.0.1 just so I can "unblock" some other webpages. That was not a good experience.
Those script can actually be delayed from loading so they won't block the page. You don't need to actually remove them, just load them AFTER your page is loaded, and then most things will be fine. (Except for Google Recaptcha of course)
It's a good practice to un-trust everything you don't have control, and maybe make exceptions from there. Don't by default trust everything.
I have a fairly international website geared towards English language learners, with Google Analytics and AdSense and links to share on Facebook, hosted on Digital Ocean here in NYC...
and, without designing for it, China has been my #1 source of traffic and revenue for many years now, simply because they're the #1 largest population of English language learners.
It seems to be working fine. I mean, maybe my share of Chinese traffic could be even bigger, but does anyone have any hard numbers showing this is a problem? Or are Chinese users aware of slow loads but just put up with it?
I browse tons of foreign websites when I grew up in China. It's actually not a big issue if the website doesn't serve video.
I lived with some Chinese students while I was exchanging and basically they said most people that want out of the Fire wall can just VPN out with no repercussions expected. Not that it’s ideal, but some commenters seem to believe that people in China have no access to the outside world which just isn’t true.
Before the internet the USSR could censor effectively, but now it’s pretty hard with encryption being as good as it is.
Of course there are people in China that don’t know that VPNs exist, but I think it’s an important nuance to mention that many people are able to have an open online experience.
https://www.scmp.com/news/china/policies-politics/article/21...
https://www.scmp.com/news/china/policies-politics/article/21...
https://www.scmp.com/tech/policy/article/2180960/chinese-vpn...
As well, I think the Chinese government has demonstrated multiple times during "sensitive times" in recent years that they can make commercial VPN services nonfunctional at the snap of a finger. If a commercial VPN service is working, it is because of the Chinese government's mercy, not because of the commercial VPN's technological ingenuity.
It leaves a bad taste in my mouth when I see commercial VPN providers advertising that they are the best or only VPN service to work in China. I remember one time I saw a viral Astrill ad floating around that said something to the effect: "We're happy that our VPN service is working great for our customers. But please don't post that your VPN service is working great. We work really hard to develop new technologies and get around the Chinese firewall, and if you keep bragging about it, the Chinese government could find out, it will make it harder for our services to work."
Super bad taste in my mouth. Come on, you know that the very first customers to download new clients are from the Chinese government working to figure out how to get it blocked. Hate this kind of disingenuous marketing.
edit: I will say that it is true that most commercial VPN services do seem to be used for most of the year and work well enough without consequences; the law seems to exist, but does not always get enforced. Would be interesting to see if China starts ratcheting up the fines over time.
The only real threat is something like Tor which is very aggressively and actively probed/blocked in China.
https://arstechnica.com/information-technology/2016/06/red-a...
How many companies work hard to make their services readily available in China? Any notable exceptions?
Within China things can be decently fast and low latency - from what I hear - and it is a large place with a lot of compute infrastructure.
You have to treat it as its own world. Where on the outside, all we see is the chaos and interruption of a hurricane, but there is a center that is harder to see where people go about their daily lives and have decent amenities and ux.
* make it as decoupled as possible from your core infra. What you spare on infra costs caused by redundancy, you will spend in maintenance time, outage mitigation, etc.
* no synchronous call going out of China mainland, otherwise you become dependent of the Great Firewall and that is not something you want
* expect lower quality of documentation and support
Is that really correct? And are there any sort of systematic measurements of that?
I seem to remember from my travels in China that accessing my websites hosted in Denmark was ok, certainly not stellar, but better than Australia.
(The rest of the advice: Don't use FB and Google - absolutely a good idea.)
I'm in China right now, and
$ curl -v http://sqlalchemy.org/
* Trying 45.33.79.102...
* TCP_NODELAY set
Then it just hangs. Meanwhile, my sites hosted in the same Linode datacenter (Newark, NJ) work fine.The internet is a place that can exist without borders, there's no reason for us to voluntarily erect any.
The application process requires you to select a Chinese city/postcode.
i've mainland proxied and cached the hell out of everything i can, warm the caches daily, but once the user starts interacting (eg search) then hitting our servers really bites randomly. usually not so bad for honkers server, but even that route can randomly drop off the face of the planet.
[1] https://crossborder.digital/how-to-test-your-page-loading-speed-in-china/Edit: Google knows https://geekflare.com/test-website-load-time-from-china/
It is sad to see that the rest of the world has to bend down to serve this repressive state. I've been to China and the people there are the same as us - I despise the party, not the people. The next generation that grows up there will not have the perspective of what it means to live in a free democratic country.
But, all bets are all if you lose significant share of your business as morality takes a backseat when it comes to profitability, market share and business goals.
it's a pretty simple idea. If you work within a framework, you're complicit by default.
You can look at it two ways : You're helping the folks in China; or you're helping the world's largest walled garden remain that way by adding content.
Also for most of people here, "unimpeachable, unchallenged leader" resembles Trump who cancelled agreements like JCOPA or Bush who atacked our neighbour countries. I'm not arguing that any of those actions are right or wrong, but many people are badly affected by the US more than they are affected by any dictator.
Censorship is doomed.
Finally, you should not underestimate how far a state can go to keep the status quo. Did we hear already: - What, they will check every phone? - What, they will demand our passwords? - What, they will slow down all out-of-country traffic? - What, they will block millions if websites, and look into every network packet? All of these were asked sarcastically, yet every point is happening now on a massive scale.
Actually, in late 90s there were a lot of talk about 'new era', because 'internet made censorship impossible'. Hold my beer! - said state bureaucracy everywhere.
Of course, technology can sometimes leapfrog gov't capabilities, but as a rule it's a very temporary thing. Censorship is a political, and cultural problem, and it needs political, and cultural pressure to be resolved.
To be honest it is not our place to tell the Chinese people how to govern themselves, that is for them to figure out.
I don't see how we're 'serving' China. The US is already in an open trade war with the country, and many other regions are growing weary, but it is not up to us to interfere in the country's internal affairs.
Assuming "their behavior" means that of the Chinese government, then I can assure you that I have also been affected.
> I believe doing what's the morally right thing to do is more important than earning a few extra bucks.
And nobody is going to disagree with that. Nobody who earns a few bucks thinks that they're morally in the wrong, but does it anyway. And it's not because they think that the Chinese government isn't evil either. They simply don't see a connection between what they do and what the government does. So arguing that the government is evil doesn't change anyone's mind, because they already agree with you on that.
You'd do better by focusing on the direct consequences of specific actions. E.g. if a Western company storing user data on Chinese servers led to the arrest of an innocent person, that's a much stronger argument than saying that you shouldn't use Chinese servers because the government is known to arrest innocent people. Otherwise the connection just isn't there.
Here's another way to look at it: being right, such as when criticizing something evil or dumb, isn't enough. For a comment to be a good one here, it needs to lead to good conversation. A comment's value on HN is the sum of the expected values of the paths it leads to.
Even the big IT companies can't make it work so why would you?
Uh, what?
They've got a firewall around their whole country, not unlike any firewall a corporation might put up to prevent their employees from accessing content the company disagrees with (like viewing pornography/4chan from the network).
Sounds like you need educating on the differences.
You're right that they do mass state surveillance though.
> They've got a firewall around their whole country, not unlike any firewall a corporation might put up to prevent their employees from accessing content the company disagrees with (like viewing pornography/4chan from the network).
I kinda think you just made his point for him. The corporate networks that are walled off in that way are often called "intranets."
Also, local Chinese websites are often significantly walled off from the rest of the internet (though through local-phone-number registration requirements, not firewall rules).
Please tell me how www.baidu.com is only accessible within China.
More than 40% of the world's e-commerce transactions currently take place in China. The United States’ share of the market is 24%, down from 35% in 2005.
> on their local Intranet
As if AliExpress.com is non-exist outside China?
Many non-China websites are blocked in China.
Yet Chinese websites serves globally.
Think about it.