Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Performance testing with Multi-Mechanize
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Rich Leland
February 07, 2012
Programming
1
400
Performance testing with Multi-Mechanize
Presentation to DC Python on Feb 7, 2012 about Multi-Mechanize, a performance testing framework.
Rich Leland
February 07, 2012
Tweet
Share
Other Decks in Programming
See All in Programming
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
190
Vibe Coding - AI 驅動的軟體開發
mickyp100
0
170
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
130
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
600
AI時代のキャリアプラン「技術の引力」からの脱出と「問い」へのいざない / tech-gravity
minodriven
21
7.1k
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
190
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
1.3k
「ブロックテーマでは再現できない」は本当か?
inc2734
0
940
CSC307 Lecture 08
javiergs
PRO
0
670
Data-Centric Kaggle
isax1015
2
770
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
260
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
300
Featured
See All Featured
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
170
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
99
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
62
49k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
49
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.9k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
200
Abbi's Birthday
coloredviolet
1
4.7k
Transcript
Rich Leland DC Python - February 7, 2012 PERFORMANCE TESTING
WITH
WHAT IS MULTI-MECHANIZE?
WHAT IS PERFORMANCE TESTING?
UNDERSTAND AND DEFINE YOUR GOALS
WRITE TESTS, RUN. RINSE & REPEAT.
None
OBLIGATORY BILL MURRAY PHOTO
NOW WHAT?
None
USE THEM ALL
WHY USE MULTI-MECHANIZE?
IT’S PYTHON OH, AND IT CAN TEST MORE THAN JUST
WEBS
PAGES
FORMS
APIs
DATABASES
CACHE
ANYTHING YOU CAN WRITE USING PYTHON
HOW DO I USE IT?
pip install multi-mechanize
multimech-newproject <myproject>
myproject ├── test_scripts │ └── example.py └── config.cfg multimech-newproject myproject
[global] run_time: 30 rampup: 0 results_ts_interval: 10 progress_bar: on console_logging:
off xml_report: off [user_group-1] threads: 3 script: example.py [user_group-2] threads: 3 script: example.py
import requests import time class Transaction(object): def run(self): start =
time.time() url = 'http://www.treehugger.com/' r = requests.get(url) latency = time.time() - start self.custom_timers['Home_Page'] = latency time.sleep(1)
multimech-run <myproject>
$ multimech-run . user_groups: 2 threads: 20 [================100%==================] 60s/60s transactions:
232 timers: 464 errors: 0 waiting for all requests to finish... analyzing results... created results/results_2012.02.06_23.11.01/results.html done.
RESULTS
myproject ├── results │ ├── results_2012.02.05_00.16.23 │ │ ├── config.cfg
│ │ ├── results.csv │ │ └── results.html │ └── static ├── test_scripts └── config.cfg Results output
None
None
AIGHT, COOL. HOW ABOUT SOME OTHER EXAMPLES?
import requests import time class Transaction(object): def run(self): start =
time.time() url = 'http://example.com/api/v1/articles/' r = requests.get(url) latency = time.time() - start self.custom_timers['API_Articles'] = latency time.sleep(1)
import time from sqlalchemy import create_engine class Transaction(object): def __init__(self):
self.custom_timers = {} conn_info = 'postgresql+psycopg2://rleland@localhost/th' self.engine = create_engine(conn_info) def run(self): start = time.time() self.engine.execute("SELECT COUNT(*) FROM cms_entry") latency = time.time() - start self.custom_timers['Entries_Count'] = latency
import memcache import random import time NODES = ['192.168.10.2:11211',] DATA_SIZE
= 30000 WAIT_TIME = .1 KEY_RANGE = (1, 1000000) class Transaction(object): def __init__(self): self.mc = memcache.Client(NODES) self.custom_timers = {} def run(self): key = str(random.randint(*KEY_RANGE)) data = '*' * DATA_SIZE start_timer = time.time() self.mc.set(key, data) stop_timer = time.time() self.custom_timers['SET'] = stop_timer - start_timer start_timer = time.time() self.mc.get(key) stop_timer = time.time() self.custom_timers['GET'] = stop_timer - start_timer time.sleep(WAIT_TIME)
None
SET GOALS WRITE TESTS RUN TESTS ANALYZE RESPOND REPEAT
THANK YOU
Docs http://testutils.org/multi-mechanize/ Code http://github.com/cgoldberg/multi-mechanize Twitter @multimechanize IRC #multimech NOW GO
GET YOU SOME