分类 Google 下的文章

How to Deploy Google BBR on CentOS 7 in GCP

BBR (Bottleneck Bandwidth and RTT) is a new congestion control algorithm which is contributed to the Linux kernel TCP stack by Google. With BBR in place, a Linux server can get significantly increased throughput and reduced latency for connections. Besides, it's easy to deploy BBR because this algorithm requires only updates on the sender side, not in the network or on the receiver side.

In this article, I will show you how to deploy BBR on a Vultr CentOS 7 KVM server instance.

Prerequisites

A Vultr CentOS 7 x64 server instance.
A sudo user.

Step 1: Upgrade the kernel using the ELRepo RPM repository

In order to use BBR, you need to upgrade the kernel of your CentOS 7 machine to 4.9.0. You can easily get that done using the ELRepo RPM repository.

Before the upgrade, you can take a look at the current kernel:

uname -r
This command should output a string which resembles:

3.10.0-514.2.2.el7.x86_64
As you see, the current kernel is 3.10.0.

Install the ELRepo repo:

**sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm**
Install the 4.9.0 kernel using the ELRepo repo:

sudo yum --enablerepo=elrepo-kernel install kernel-ml -y
Confirm the result:

rpm -qa | grep kernel
If the installation is successful, you should see kernel-ml-4.9.0-1.el7.elrepo.x86_64 among the output list:

kernel-ml-4.9.0-1.el7.elrepo.x86_64
kernel-3.10.0-514.el7.x86_64
kernel-tools-libs-3.10.0-514.2.2.el7.x86_64
kernel-tools-3.10.0-514.2.2.el7.x86_64
kernel-3.10.0-514.2.2.el7.x86_64
Now, you need to enable the 4.9.0 kernel by setting up the default grub2 boot entry.

Show all entries in the grub2 menu:

sudo egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'
The result should resemble:

CentOS Linux 7 Rescue a0cbf86a6ef1416a8812657bb4f2b860 (4.9.0-1.el7.elrepo.x86_64)
CentOS Linux (4.9.0-1.el7.elrepo.x86_64) 7 (Core)
CentOS Linux (3.10.0-514.2.2.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-bf94f46c6bd04792a6a42c91bae645f7) 7 (Core)
Since the line count starts at 0 and the 4.9.0 kernel entry is on the second line, set the default boot entry as 1:

sudo grub2-set-default 1
Reboot the system:

sudo shutdown -r now
When the server is back online, log back in and rerun the uname command to confirm that you are using the correct Kernel:

uname -r
You should see the result as below:

4.9.0-1.el7.elrepo.x86_64

Step 2: Enable BBR

In order to enable the BBR algorithm, you need to modify the sysctl configuration as follows:

**echo 'net.core.default_qdisc=fq' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_congestion_control=bbr' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p**
Now, you can use the following commands to confirm that BBR is enabled:

sudo sysctl net.ipv4.tcp_available_congestion_control
The output should resemble:

net.ipv4.tcp_available_congestion_control = bbr cubic reno
Next, verify with:

sudo sysctl -n net.ipv4.tcp_congestion_control
The output should be:

bbr
Finally, check that the kernel module was loaded:

lsmod | grep bbr
The output will be similar to:

tcp_bbr 16384 0

Step 3 (optional): Test the network performance enhancement

In order to test BBR's network performance enhancement, you can create a file in the web server directory for download, and then test the download speed from a web browser on your desktop machine.

**sudo yum install httpd -y
sudo systemctl start httpd.service
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload
cd /var/www/html
sudo dd if=/dev/zero of=500mb.zip bs=1024k count=500**
Finally, visit the URL http://[your-server-IP]/500mb.zip from a web browser on your desktop computer, and then evaluate download speed.

That's all. Thank you for reading.

How to Deploy Google BBR on CentOS 6 in GCP

BBR (Bottleneck Bandwidth and RTT) is a new congestion control algorithm which is contributed to the Linux kernel TCP stack by Google. With BBR in place, a Linux server can get significantly increased throughput and reduced latency for connections. Besides, it's easy to deploy BBR because this algorithm requires only updates on the sender side, not in the network or on the receiver side.

In this article, I will show you how to deploy BBR on a Vultr CentOS 7 KVM server instance.

Prerequisites

A Vultr CentOS 6 x64 server instance.
A sudo user.

Step 1: Upgrade the kernel using the ELRepo RPM repository

In order to use BBR, you need to upgrade the kernel of your CentOS 7 machine to 4.9.0. You can easily get that done using the ELRepo RPM repository.

Before the upgrade, you can take a look at the current kernel:

uname -r
This command should output a string which resembles:

2.6.32-642.15.1.el6.x86_64
As you see, the current kernel is 2.6.32.

Install the ELRepo repo:

sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
Install the 4.10.4 kernel using the ELRepo repo:

sudo yum --enablerepo=elrepo-kernel install kernel-ml -y
Confirm the result:

rpm -qa | grep kernel
If the installation is successful, you should see kernel-ml-4.10.4-1.el6.elrepo.x86_64 among the output list:

dracut-kernel-004-409.el6_8.2.noarch
kernel-2.6.32-573.el6.x86_64
kernel-ml-4.10.4-1.el6.elrepo.x86_64
kernel-headers-2.6.32-642.15.1.el6.x86_64
abrt-addon-kerneloops-2.0.8-40.el6.centos.x86_64
kernel-2.6.32-642.15.1.el6.x86_64
kernel-firmware-2.6.32-642.15.1.el6.noarch
libreport-plugin-kerneloops-2.0.9-32.el6.centos.x86_6

Now, you need to enable the 4.10.4 kernel by setting up the default grub boot entry.

Show all entries in the grub2 menu:

sudo sed -i 's:default=.*:default=0:g' /etc/grub.conf

Reboot the system:

sudo shutdown -r now
When the server is back online, log back in and rerun the uname command to confirm that you are using the correct Kernel:

uname -r
You should see the result as below:

4.10.4-1.el6.elrepo.x86_64

Step 2: Enable BBR

In order to enable the BBR algorithm, you need to modify the sysctl configuration as follows:

echo 'net.core.default_qdisc=fq' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_congestion_control=bbr' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
Now, you can use the following commands to confirm that BBR is enabled:

sudo sysctl net.ipv4.tcp_available_congestion_control
The output should resemble:

net.ipv4.tcp_available_congestion_control = bbr cubic reno
Next, verify with:

sudo sysctl -n net.ipv4.tcp_congestion_control
The output should be:

bbr
Finally, check that the kernel module was loaded:

lsmod | grep bbr
The output will be similar to:

tcp_bbr 16384 0

Step 3 (optional): Test the network performance enhancement

In order to test BBR's network performance enhancement, you can create a file in the web server directory for download, and then test the download speed from a web browser on your desktop machine.

sudo yum install httpd -y
sudo server httpd start
cd /var/www/html
sudo dd if=/dev/zero of=500mb.zip bs=1024k count=500
Finally, visit the URL http://[your-server-IP]/500mb.zip from a web browser on your desktop computer, and then evaluate download speed.

That's all. Thank you for reading.

android studio gradle的问题

1、相信大家都遇到每次升级了android studio之后,gradle又要同步的这个痛苦过程,因为gradle被墙,所以只能用其他办法下载压缩包。
2、自定义gradle路径每次都要麻烦一下,这次采用官方推荐的办法,不知道会不会也存在一样的问题,如下图所示:
gradle.png
3、下载gradle并配置
gradle2.png
下载下来的安装包放到gradle配置的相应目录,默认如下图,注意对应的版本号和路径
gradle3.png

将 MySQL 数据库放到云端的 Google Cloud SQL 升级,增加半年免费体验

Google Cloud SQL这个云端MySQL数据库服务今天做出了大幅更新:

  • 更多的存储空间:最大100GB,是以前是10倍多
  • 更快的读取速度:每个实例最大可用到16GB内存,是以前是4倍
  • 更快的写入速度:增加了异步响应功能
  • 增加欧洲数据中心:现在你可选美国或欧洲两个数据中心
  • 整合Google Apps Script:方便Google Apps客户使用Cloud SQL,可共享Google Sheets里的数据,或是直接将数据加入到Google Sites的页面里,创建Google Forms而不必再去配置额外的服务器

- 阅读剩余部分 -

Urchin与Google Analytics的区别

谷歌分析与Urchin到底有什么样的差异? 甚至有许多人都认为谷歌分析(Google Analytics)只是,Urchin的演示版。实际情况并非如此!

谷歌分析(GA)是一个全功能的网站分析产品,而Urchin是基于日志的网站分析工具,Urchin是一种综合的网站分析解决方案,可以同时使用JavaScript的标记和服务器日志文件,增加了更丰富的细节分析功能。Urchin的数据报告也是独立存储在客户自己的服务器上,为企业减少数据泄漏风险;而谷歌分析(GA)属于SAAS类托管服务,不支持日志级别的分析。

Urchin vs. Google Analytics

免费 VS  商业付费

Google Analytics当然是免费的,而Google Urchin的价格是$2995美金,并只能通过Urchin授权顾问来购买,现在国内有一个唯一的授权顾问,上海乐信。

更多的报告配置支持

目前谷歌分析(GA)支持100个网站的报告配置。Google Urchin支持1000个网站报告配置,以及1000个网站日志源分析,但是Urchin可以通过购买许可证的方式扩展对更多网站报告与网站日志源的支持。

独立服务器数据托管 VS  谷歌SAAS托管

许多组织,例如学校,银行、政府机构,必须把数据存储在内部网络防火墙后面的服务器,Urchin 6能很好的支持这一点,并且具有极具竞争力的性价比,比起Webtrends公司等网站分析服务($ 10,000 +).当然您的网站是否在内部防火墙后面并不能成为选择Google Analytics还是Urchin的关键因素! 如果您在使用谷歌分析(GA),也无需担心谷歌会泄漏您的数据,您可以点击这里,查看谷歌的隐私政权政策。

日志文件处理 VS   JavaScript的标记

谷歌分析(GA)收集数据的方式,是根据部署的特殊的JavaScript谷歌分析跟踪代码(GATC),到每一个WEB页面。Urchin同样适用类似GA的跟踪代码,所不同的是,Urchin包括了日志分析收集的代码,这将有效的收集到特定网页上,每一个访问者深层的用户行为。虽然您发现Urchin和谷歌分析一样,可以收集(用户访问地域、所用操作系统平台、浏览器版本、用户会话次数、访问路径等信息)但是Urchin为客户提供了更多用户行为细节的分析,例如用户访问路径行为。

数据后处理 VS   直接存储

使用Urchin日志文件,可以重新处理您的网站分析数据。Urchin将允许你挖掘旧的日志文件,并可以按照你新定义的KPI转换重新处理转换数据。例如:你可以重新设置一个新的KPI转换,设置成功后您就直接可以看到有多少用户在以前的时间段和现在的时间完成了我们设定的KPI转换。而在谷歌分析(GA)中,只能分析到应用KPI转换后,后面时间段的数据!

此外,由于Urchin数据直接存储到您自己的服务器数据库上,没有任何数据泄漏风险,当然您主要做好冗余备份,您的数据将永远不会丢失。而谷歌分析(GA)只承诺保留18个个月的数据,为了削减服务器上的数据腾出存储空间和带宽,为更多的用户提供免费服务。

搜索引擎蜘蛛活动报告

Urchin可以跟踪搜索引擎robot,蜘蛛的爬行。而谷歌分析无法跟踪蜘蛛在网站上是如何爬行的活动。因为蜘蛛的爬行无法执行JavaScript。Urchin是记录每一个网站页面访问请求,包括记录搜索引擎蜘蛛对网站的请求,这可能导致Urchin与Google Analytics之间的数据差异。

访问用户分析

由于Urchin是基于日志的分析工具,从而可以很容易获取到用户的访问IP,并且可以分析这个用户,或者这个IP访问的行为数据,并从这个基础上挖掘出相关的行为报告。尽管如此,但是Urchin所有挖掘的信息都是匿名的,您无法获得更详细的用户身份信息。

非网页访问分析

基于日志分析的Urchin,可以对用户对于非网页的访问请求进行细致分析,例如图片、文件下载甚至是服务器请求错误。这让你可以轻松跟踪到重定向错误页面,或者黑客嵌入相关网页到你网站页面获取的访问。

更丰富的自定义报告

随着更多的收据收集,丰富的自定义报告功能是非常有必要的。Urchin提供更多自定义报告,使你可以更好的利用的你分析数据,并根据丰富的报表得到相关见解和改进决策依据!

Urchin功能局限

谷歌分析(Google Analytics)是谷歌的旗舰网站分析产品,虽然Urchin提供的许多功能谷歌分析(GA)并不支持,但是谷歌分析有几个重要的报告,Urchin不支持,其中包括了高级群体分析、事件跟踪、基准分析。

最后我们建议,如果您的公司并未要求必须保护网站分析数据的隐私权的话,那么您可以同时应用Urchin与谷歌分析,获得更多利于分析的综合分析数据。有兴趣的朋友可以到谷歌Urchin官方去下载30天试用版本,官方下载网址请点击这里访问!