简体   繁体   English

使用socket.io的基于Nginx国家的路由

[英]Nginx country based routing with socket.io

I am trying to run a node.js - mongo db application with nginx as a reverse proxy on digital ocean and mlab. 我正在尝试运行node.js-mongo db应用程序,并使用nginx作为数字海洋和mlab上的反向代理。

My website will be used from usa, india, uk and some asian countries potentially. 我的网站可能会在美国,印度,英国和某些亚洲国家/地区使用。

I have created my droplet on digital ocean in bangalore, India site. 我已经在印度班加罗尔的数字海洋上创建了我的液滴。 Config - ubuntu 14x, 2GB Ram, 40 GB disk. 配置-ubuntu 14x,2GB Ram,40 GB磁盘。

I was very surprised to notice that the performance of the site when accessed from USA is terrible. 我很惊讶地注意到,从美国访问该网站时的性能非常糟糕。 It takes around 25 seconds to load. 加载大约需要25秒。 However the same url can be accessed within 6 seconds from Mumbai, India. 但是,可以从印度孟买在6秒内访问相同的URL。

Lot of my files are already minimized, images are compreseed etc. 我的很多文件已被最小化,图像被压缩等。

So what are my options at this time? 那我现在有什么选择呢? I can try to do subdomains and have nginx do County based routing to different servers but what impact will it have on socket.io? 我可以尝试做子域,让nginx将County路由到不同的服务器,但是这会对socket.io产生什么影响?

Will i have to do have nginx on each individual servers as well? 我还要在每台服务器上都安装Nginx吗? Or just in routing server? 还是仅在路由服务器中? What about nginx caching? 那nginx缓存呢? On which site will i create the server which does routing? 我将在哪个站点上创建路由服务器?

Any examples will be greatly appreciated! 任何例子将不胜感激! Thanks in advance 提前致谢

I ended up using cloudflare for CDN. 我最终将cloudflare用于CDN。 I saw significant improvement in speed. 我看到速度有了显着提高。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM