[ATC] Facebook Open Source Weak Network Simulation Tool

It should be noted as follows: 1. The author uses a linux USB network card, which is to let the mobile phone connect to the Linux Server to enable the service. 2. When starting the service, it is necessary to specify the name of the internal network card and the name of the external network card, so that when the mobile phone selects the internal network card The speed is affected by the limit, and the external network card can continue to access, otherwise it will prompt ATC is not running. 3. The author successfully built the ATC system on his own H5 server, and solved the include problem, the problem that the queue could not be found, and the page style was lost.

 

In our previous network test, the network speed was mainly limited to simulate a weak network environment, but in the actual weak network, the network delay and packet loss rate will change, so use network speed + packet loss rate + delay to define A network environment is more reasonable

This article introduces the construction and use of the ATC tool environment. The construction method comes from the instructions in Facebook's official github, https://github.com/facebook/augmented-traffic-control, here are some translations and supplements

 

1. To use ATC, you first need to create a hotspot under linux. For the method, please refer to " Create a Wireless (WiFi) Hotspot on Ubuntu of Virtualbox ".

2. Install pip, enter sudo apt-get install python-pip in the terminal

3. Install the django components required by ATC through pip

pip install atc_thrift atcd django-atc-api django-atc-demo-ui django-atc-profile-storage

4. Create a django project to use the ATC server app

 

django-admin startproject atcui
cd atcui
5. Enter the atcui directory, note that there are two layers of directories, edit settings.py

 

Add the following to INSTALLED_APPS,

 

# Django ATC API
    'rest_framework',
    'atc_api',
    # Django ATC Demo UI
    'bootstrap_themes',
    'django_static_jquery',
    'atc_demo_ui',
    # Django ATC Profile Storage
    'atc_profile_storage',
My final fill is like this,

 

6. Edit urls.py and import

from django.views.generic.base import RedirectView
Add the following to urlpatterns

 

 

# Django ATC API
    url(r'^api/v1/', include('atc_api.urls')),
    # Django ATC Demo UI
    url(r'^atc_demo_ui/', include('atc_demo_ui.urls')),
    # Django ATC profile storage
    url(r'^api/v1/profiles/', include('atc_profile_storage.urls')),
    url(r'^$', RedirectView.as_view(url='/atc_demo_ui/', permanent=False)),
I ended up like this, a little different from the official website format, here is an array

 

7, with the new django database,

 

python manage.py migrate
8. After the configuration is completed, it can be run. Here, the network card eth0 is used as the public network connection, and wlan0 is used as the internal network connection. It is specified by parameters at startup.

 

 

sudo atcd --atcd-wan eth0 --atcd-lan wlan0
9. Run ATC UI 

 

 

python manage.py runserver 0.0.0.0:8000
10. At this time, you can see the control page by accessing 192.168.0.1:8000 through the mobile phone browser (if the hotspot gateway is set to 192.168.0.1),

 

 Note: I used 4 mobile phones to open it, and only the sons of Google can open it normally. This may be caused by the fact that other roms do not have the Google service framework. I tried to install chrome on other mobile phones but they could not start.

11. Facebook has configured the common network configuration for us in its own project, which can be added in the following ways

    

git clone https://github.com/facebook/augmented-traffic-control.git
Run after the download code is complete
utils/restore-profiles.sh localhost:8000
Then refresh the mobile browser page, you can see the pre-made network configuration
If you want to switch the configuration, just click the "Select" button next to the configuration, and then click the "Update Shaping" button above.
The actual measurement shows that the network speed has indeed changed, but the two parameters of packet loss rate and delay are not easy to observe through the periphery.
 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326941512&siteId=291194637