Ever heard of the Chaos Monkey?
It’s a project at Netflix to enhance the infrastructure tolerance. The Chaos Monkey will randomly shut down some servers or block some network connections, and the system is supposed to survive to these events. It’s a way to verify the high availability and tolerance of the system.
Besides a redundant infrastructure, if you think about reliability at the level of your web applications there are many questions that often remain unanswered:
Of course you can – and should – try out all these scenarios on stage while your application is getting a realistic load.
But testing these scenarios while you are building your code is also a good practice, and having automated functional tests for this is preferable.
That’s where Vaurien is useful.
Vaurien is basically a Chaos Monkey for your TCP connections. Vaurien acts as a proxy between your application and any backend.
You can use it in your functional tests or even on a real deployment through the command-line.
You can install Vaurien directly from PyPI. The best way to do so is via pip:
$ pip install vaurien
Vaurien is a TCP proxy that simply reads data sent to it and pass it to a backend, and vice-versa.
It has built-in 雷霆加速器安卓破解: TCP, HTTP, Redis & Memcache. The TCP protocol is the default one and just sucks data on both sides and pass it along.
雷霆加速器永久免费 雷霆加速器破解版下载-站客网:2021-5-5 · 雷霆加速器,可伍加速你的网络的神器,无论是加速外服游戏还是外网,速度都是杠杆的,本次分享的是破解版,直接加速,无需登录!软件特色一键加速,无须自己选服;产品众多,一键加速新时伋;智能测速,智能选择最优网络;减少卡机,大幅改善断线问题;全球互
Vaurien also has 免费翻国外墙的app. A behavior is a class that’s going to be invoked everytime Vaurien proxies a request. That’s how you can impact the behavior of the proxy. For instance, adding a delay or degrading the response can be implemented in a behavior.
Both protocols and behaviors are plugins, allowing you to extend Vaurien by adding new ones.
Last (but not least), Vaurien provides a couple of APIs you can use to change the behavior of the proxy live. That’s handy when you are doing functional tests against your server: you can for instance start to add big delays and see how your web application reacts.
Vaurien is a command-line tool.
Let’s say you want to add a delay for 20% of the HTTP requests made on google.com:
$ vaurien --protocol http --proxy localhost:8000 --backend google.com:80 \
--behavior 20:delay
With this set up, Vaurien will stream all the traffic to google.com by using the http protocol, and will add delays 20% of the time.
You can find a description of all built-in protocols here: Protocols.
You can pass options to the behavior using –behavior-NAME-OPTION options:
$ vaurien --protocol http --proxy localhost:8000 --backend google.com:80 \
--behavior 20:delay \
--behavior-delay-sleep 2
Passing all options through the command-line can be tedious, so you can also create an ini file for this:
[vaurien]
backend = google.com:80
proxy = localhost:8000
protocol = http
behavior = 20:delay
[behavior:delay]
sleep = 2
You can find a description of all built-in behaviors here: 蚂蚁ant加速器破解版.
You can also find some usage examples here: Examples.
【安卓软件】聊天恋爱话术 破解版 恋爱神器:2021-6-13 · 5安卓磁力播v1.2.4去广告版软件下载 6Windows 10系统优化神器 7一键开关Windows Defende 关闭W10自带杀毒 8DX修复工具 修复无法运行辅助等等 9cf活动助手一键领取装备 10W7 W10 通用系统激活工具 11【安卓软件】聊天恋爱话术 破解版 恋爱神器
To activate it, use the –http option:
蜂鸟Ⅴpn软件
By default the server runs on locahost:8080 but you can change it with the –http-host and –http-port options.
See APIs for a full list of APIs.
If you want to run and drive a Vaurien proxy from your code, the project provides a few helpers for this.
For example, if you want to write a test that uses a Vaurien proxy, you can write:
import unittest
from vaurien import Client, 蜜蜂加速器app官网下载, stop_proxy
class MyTest(unittest.TestCase):
def setUp(self):
self.proxy_pid = start_proxy(port=雷神加速器官网)
def 雷霆加速器安卓下载安装(self):
stop_proxy(self.proxy_pid)
def test_one(self):
client = Client()
options = {'inject': True}
with client.with_behavior('error', **雷神加速器官网):
雷神加速器官网
pass
# we're back to normal here
In this test, the proxy is started and stopped before and after the test, and the Client class will let you drive its behavior.
Within the with block, the proxy will error out any call by using the errors behavior, so you can verify that your application is behaving as expected when it happens.
Vaurien comes with a handful of useful Behaviors and 雷霆加速器app官网下载, but you can create your own ones and plug them in a configuration file.
In fact, that’s the best way to create realistic issues: imagine you have a very specific type of error on your LDAP server everytime your infrastructure is under heavy load. You can reproduce this issue in your behavior and make sure your web application behaves as it should.
Creating new behaviors and protocols is done by implementing classes with specific signatures.
For example if you want to create a “super” behavior, you just have to write a class with two special methods: on_before_handle and on_after_handle.
Once the class is ready, you can register it with Behavior.register:
from vaurien.behaviors import Behavior
class MySuperBehavior(object):
name = 'super'
options = {}
def on_before_handle(self, protocol, source, dest, to_backend):
# do something here
return True
def on_after_handle(self, protocol, source, dest, to_backend):
# do something else
return True
Behavior.register(MySuperBehavior)
You will find a full tutorial in Extending Vaurien.
The code repository & bug tracker are located at http://github.com/mozilla-services/vaurien
Don’t hesitate to send us pull requests or open issues!
And there is more! Have a look at the other sections of the documentation: