-
Notifications
You must be signed in to change notification settings - Fork 1
/
locust.html
767 lines (491 loc) · 55.7 KB
/
locust.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
<!DOCTYPE html>
<html>
<head>
<!-- Document Settings -->
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- Base Meta -->
<!-- dynamically fixing the title for tag/author pages -->
<title>Mesurer la performance avec Locust</title>
<meta name="HandheldFriendly" content="True" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Styles'n'Scripts -->
<link rel="stylesheet" type="text/css" href="/assets/built/screen.css" />
<link rel="stylesheet" type="text/css" href="/assets/built/screen.edited.css" />
<link rel="stylesheet" type="text/css" href="/assets/built/syntax.css" />
<!-- highlight.js -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
<style>.hljs { background: none; }
.site-footer-nav a::before {
content: None !important;
}
</style>
<!--[if IE]>
<style>
p, ol, ul{
width: 100%;
}
blockquote{
width: 100%;
}
</style>
<![endif]-->
<!-- This tag outputs SEO meta+structured data and other important settings -->
<meta name="description" content="Le blog d'Alejandro Mantecón Guillén" />
<link rel="shortcut icon" href="http://alemangui.github.io/assets/images/favicon.png" type="image/png" />
<link rel="canonical" href="http://alemangui.github.io/locust" />
<meta name="referrer" content="no-referrer-when-downgrade" />
<!--title below is coming from _includes/dynamic_title-->
<meta property="og:site_name" content="Alejandro Mantecón Guillén" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Mesurer la performance avec Locust" />
<meta property="og:description" content="Toute application doit pouvoir répondre à un certain nombre de requêtes sous un temps minimum jugé comme acceptable. Ceci peut varier énormément. Google fait face à des millions d’utilisateurs et se fixe des objectifs de performance très ambitieux. D’un autre côté, un système de gestion d’inventaires d’une petite épicerie difficilement" />
<meta property="og:url" content="http://alemangui.github.io/locust" />
<meta property="og:image" content="http://alemangui.github.io/assets/images/chrono.jpg" />
<meta property="article:publisher" content="https://www.facebook.com/" />
<meta property="article:author" content="https://www.facebook.com/" />
<meta property="article:published_time" content="2020-02-11T00:00:00+01:00" />
<meta property="article:modified_time" content="2020-02-11T00:00:00+01:00" />
<meta property="article:tag" content="Développement" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Mesurer la performance avec Locust" />
<meta name="twitter:description" content="Toute application doit pouvoir répondre à un certain nombre de requêtes sous un temps minimum jugé comme acceptable. Ceci peut varier énormément. Google fait face à des millions d’utilisateurs et se fixe des objectifs de performance très ambitieux. D’un autre côté, un système de gestion d’inventaires d’une petite épicerie difficilement" />
<meta name="twitter:url" content="http://alemangui.github.io/" />
<meta name="twitter:image" content="http://alemangui.github.io/assets/images/chrono.jpg" />
<meta name="twitter:label1" content="Written by" />
<meta name="twitter:data1" content="Alejandro Mantecón Guillén" />
<meta name="twitter:label2" content="Filed under" />
<meta name="twitter:data2" content="Développement" />
<meta name="twitter:site" content="@alemangui" />
<meta name="twitter:creator" content="@alemangui" />
<meta property="og:image:width" content="1400" />
<meta property="og:image:height" content="933" />
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Website",
"publisher": {
"@type": "Organization",
"name": "Alejandro Mantecón Guillén",
"logo": "http://alemangui.github.io/assets/images/blog-icon.png"
},
"url": "http://alemangui.github.io/locust",
"image": {
"@type": "ImageObject",
"url": "http://alemangui.github.io/assets/images/chrono.jpg",
"width": 2000,
"height": 666
},
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "http://alemangui.github.io/locust"
},
"description": "Toute application doit pouvoir répondre à un certain nombre de requêtes sous un temps minimum jugé comme acceptable. Ceci peut varier énormément. Google fait face à des millions d’utilisateurs et se fixe des objectifs de performance très ambitieux. D’un autre côté, un système de gestion d’inventaires d’une petite épicerie difficilement"
}
</script>
<meta name="generator" content="Jekyll 3.6.2" />
<link rel="alternate" type="application/rss+xml" title="Mesurer la performance avec Locust" href="/feed.xml" />
</head>
<body class="post-template">
<div class="site-wrapper">
<!-- All the main content gets inserted here, index.hbs, post.hbs, etc -->
<!-- default -->
<!-- The tag above means: insert everything in this file
into the {body} of the default.hbs template -->
<header class="site-header outer">
<div class="inner">
<nav class="site-nav">
<div class="site-nav-left">
<a class="site-nav-logo" href="http://alemangui.github.io/"><img src="/assets/images/blog-icon.png" alt="Alejandro Mantecón Guillén" /></a>
<ul class="nav" role="menu">
<li class="nav-home" role="menuitem"><a href="/">Blog</a></li>
<li class="nav-about" role="menuitem"><a href="/about/">About Me</a></li>
</ul>
</div>
<div class="site-nav-right">
<div class="social-links">
<a class="social-link social-link-tw" href="https://twitter.com/alemangui" target="_blank" rel="noopener"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M30.063 7.313c-.813 1.125-1.75 2.125-2.875 2.938v.75c0 1.563-.188 3.125-.688 4.625a15.088 15.088 0 0 1-2.063 4.438c-.875 1.438-2 2.688-3.25 3.813a15.015 15.015 0 0 1-4.625 2.563c-1.813.688-3.75 1-5.75 1-3.25 0-6.188-.875-8.875-2.625.438.063.875.125 1.375.125 2.688 0 5.063-.875 7.188-2.5-1.25 0-2.375-.375-3.375-1.125s-1.688-1.688-2.063-2.875c.438.063.813.125 1.125.125.5 0 1-.063 1.5-.25-1.313-.25-2.438-.938-3.313-1.938a5.673 5.673 0 0 1-1.313-3.688v-.063c.813.438 1.688.688 2.625.688a5.228 5.228 0 0 1-1.875-2c-.5-.875-.688-1.813-.688-2.75 0-1.063.25-2.063.75-2.938 1.438 1.75 3.188 3.188 5.25 4.25s4.313 1.688 6.688 1.813a5.579 5.579 0 0 1 1.5-5.438c1.125-1.125 2.5-1.688 4.125-1.688s3.063.625 4.188 1.813a11.48 11.48 0 0 0 3.688-1.375c-.438 1.375-1.313 2.438-2.563 3.188 1.125-.125 2.188-.438 3.313-.875z"/></svg>
</a>
<a class="social-link social-link-tw" href="https://codepen.io/alemangui" target="_blank" rel="noopener"><?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 32.768 32.768" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><metadata><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/><dc:title/></cc:Work></rdf:RDF></metadata><defs><clipPath id="b"><path d="m0 500h500v-500h-500z"/></clipPath><filter id="a" x="-.012" y="-.012" width="1.024" height="1.024" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="2.3454725"/></filter></defs><g transform="matrix(.068217 0 0 -.068216 -.63927 33.469)" filter="url(#a)"><g clip-path="url(#b)"><g transform="matrix(1.631 0 0 1.631 445.42 216.43)"><path d="m0 0-31.18 20.858 31.18 20.857zm-107.63-88.412v58.133l54.035 36.138 43.619-29.172zm-12.462 79.784-44.084 29.486 44.084 29.486 44.08-29.486zm-12.466-79.784-97.655 65.099 43.623 29.172 54.032-36.138zm-107.63 130.13 31.183-20.857-31.183-20.858zm107.63 88.413v-58.133l-54.032-36.146-43.623 29.181zm24.928 0 97.654-65.098-43.619-29.181-54.035 36.146zm132.45-63.458c-0.026 0.183-0.072 0.358-0.102 0.541-0.062 0.352-0.126 0.703-0.218 1.046-0.054 0.206-0.13 0.404-0.194 0.602-0.1 0.306-0.199 0.611-0.321 0.908-0.085 0.206-0.183 0.412-0.278 0.61-0.131 0.283-0.267 0.558-0.424 0.824-0.114 0.199-0.236 0.39-0.354 0.58-0.168 0.26-0.34 0.512-0.528 0.756-0.136 0.183-0.281 0.366-0.426 0.542-0.199 0.228-0.405 0.457-0.622 0.671-0.163 0.167-0.325 0.335-0.496 0.488-0.229 0.206-0.465 0.405-0.706 0.595-0.186 0.145-0.37 0.29-0.564 0.427-0.073 0.046-0.137 0.107-0.206 0.153l-132.56 88.374c-4.187 2.792-9.639 2.792-13.827 0l-132.56-88.374c-0.069-0.046-0.134-0.107-0.206-0.153-0.195-0.137-0.378-0.282-0.561-0.427-0.244-0.19-0.481-0.389-0.705-0.595-0.176-0.153-0.336-0.321-0.5-0.488-0.217-0.214-0.423-0.443-0.618-0.671-0.149-0.176-0.294-0.359-0.431-0.542-0.183-0.244-0.359-0.496-0.523-0.756-0.126-0.19-0.244-0.381-0.358-0.58-0.153-0.266-0.29-0.541-0.424-0.824-0.095-0.198-0.194-0.404-0.278-0.61-0.122-0.297-0.221-0.602-0.321-0.908-0.065-0.198-0.137-0.396-0.194-0.602-0.092-0.343-0.153-0.694-0.218-1.046-0.03-0.183-0.076-0.358-0.099-0.541-0.073-0.534-0.114-1.076-0.114-1.625v-88.374c0-0.549 0.041-1.091 0.114-1.633 0.023-0.176 0.069-0.358 0.099-0.533 0.065-0.352 0.126-0.702 0.218-1.046 0.057-0.206 0.129-0.404 0.194-0.603 0.1-0.304 0.199-0.61 0.321-0.915 0.084-0.207 0.183-0.405 0.278-0.603 0.134-0.281 0.271-0.556 0.424-0.831 0.114-0.192 0.232-0.381 0.358-0.572 0.164-0.26 0.34-0.512 0.523-0.756 0.137-0.191 0.282-0.366 0.431-0.541 0.195-0.229 0.401-0.458 0.618-0.672 0.164-0.167 0.324-0.335 0.5-0.487 0.224-0.208 0.461-0.406 0.705-0.596 0.183-0.146 0.366-0.29 0.561-0.427 0.072-0.046 0.137-0.107 0.206-0.152l132.56-88.375c2.094-1.396 4.505-2.098 6.916-2.098 2.407 0 4.817 0.702 6.911 2.098l132.56 88.375c0.069 0.045 0.133 0.106 0.206 0.152 0.194 0.137 0.378 0.281 0.564 0.427 0.241 0.19 0.477 0.388 0.706 0.596 0.171 0.152 0.333 0.32 0.496 0.487 0.217 0.214 0.423 0.443 0.622 0.672 0.145 0.175 0.29 0.35 0.426 0.541 0.188 0.244 0.36 0.496 0.528 0.756 0.118 0.191 0.24 0.38 0.354 0.572 0.157 0.275 0.293 0.55 0.424 0.831 0.095 0.198 0.193 0.396 0.278 0.603 0.122 0.305 0.221 0.611 0.321 0.915 0.064 0.199 0.14 0.397 0.194 0.603 0.092 0.344 0.156 0.694 0.218 1.046 0.03 0.175 0.076 0.357 0.102 0.533 0.069 0.542 0.112 1.084 0.112 1.633v88.374c0 0.549-0.043 1.091-0.112 1.625"/></g></g></g></svg>
</a>
<a class="social-link social-link-tw" href="https://linkedin.com/in/alemangui" target="_blank" rel="noopener"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z"/></svg></a>
<a class="social-link social-link-tw" href="https://github.com/alemangui" target="_blank" rel="noopener"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/></svg></a>
<a class="social-link social-link-tw" href="https://stackoverflow.com/users/1046444" target="_blank" rel="noopener"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M15 21h-10v-2h10v2zm6-11.665l-1.621-9.335-1.993.346 1.62 9.335 1.994-.346zm-5.964 6.937l-9.746-.975-.186 2.016 9.755.879.177-1.92zm.538-2.587l-9.276-2.608-.526 1.954 9.306 2.5.496-1.846zm1.204-2.413l-8.297-4.864-1.029 1.743 8.298 4.865 1.028-1.744zm1.866-1.467l-5.339-7.829-1.672 1.14 5.339 7.829 1.672-1.14zm-2.644 4.195v8h-12v-8h-2v10h16v-10h-2z"/></svg></a>
<a class="social-link social-link-tw" href="https://www.instagram.com/alemangui" target="_blank" rel="noopener"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z"/></svg></a>
</div>
</div>
</nav>
</div>
</header>
<!-- Everything inside the #post tags pulls data from the post -->
<!-- #post -->
<main id="site-main" class="site-main outer" role="main">
<div class="inner">
<article class="post-full ">
<header class="post-full-header">
<section class="post-full-meta">
<time class="post-full-meta-date" datetime="11 February 2020">11 February 2020</time>
<span class="date-divider">/</span>
<a href='/tag/développement/'>DÉVELOPPEMENT</a>,
<a href='/tag/python/'>PYTHON</a>
</section>
<h1 class="post-full-title">Mesurer la performance avec Locust</h1>
</header>
<figure class="post-full-image" style="background-image: url(/assets/images/chrono.jpg)">
</figure>
<section class="post-full-content">
<div class="kg-card-markdown">
<p>Toute application doit pouvoir répondre à un certain nombre de requêtes sous un temps minimum jugé comme acceptable. Ceci peut varier énormément. Google fait face à des millions d’utilisateurs et se fixe des objectifs de performance très ambitieux. D’un autre côté, un système de gestion d’inventaires d’une petite épicerie difficilement aura plus d’une poignée d’utilisateurs et n’aura pas les mêmes contraintes de temps de réponse.</p>
<p>Les tests de charge servent à assurer que notre application réponde à nos objectifs liés au nombre d’utilisateurs simultanées et temps de réponse. C’est là que <a href="https://locust.io/">Locust</a> rentre en action : un outil pour simuler des utilisateurs virtuels et permettre leur analyse. Par rapport aux alternatives Locust a un grand plus : on écrit nos tests en Python pur et dur.</p>
<h2 id="préparons-le-terrain">Préparons le terrain</h2>
<p>Avant de jouer avec Locust, il faut bien qu’on ait quelque chose à tester. Pour le fun, nous allons faire un hello-world avec Flask.</p>
<p>Je vais d’abord démarrer un environnement virtuel avec Python 3 dans un dossier vide, suivi de l’installation de Flask avec <code class="highlighter-rouge">pip</code> :</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">» virtualenv <span class="nt">-p</span> python3 venv
» <span class="nb">.</span> venv/bin/activate
» pip install flask</code></pre></figure>
<p>Créons maintenant un fichier <code class="highlighter-rouge">hello.py</code> avec le code disponible dans le <a href="https://flask.palletsprojects.com/en/1.1.x/quickstart/#a-minimal-application">site Flask</a>.</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span>
<span class="n">app</span> <span class="o">=</span> <span class="n">Flask</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">'/'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">hello_world</span><span class="p">():</span>
<span class="k">return</span> <span class="s">'Hello, World!'</span></code></pre></figure>
<p>Et voilà, nous avons un endpoint sur <code class="highlighter-rouge">http://127.0.0.1:5000/</code>.</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">» <span class="nb">export </span><span class="nv">FLASK_APP</span><span class="o">=</span>hello.py<span class="p">;</span> flask run
<span class="k">*</span> Serving Flask app <span class="s2">"hello.py"</span>
<span class="k">*</span> Debug mode: off
<span class="k">*</span> Running on http://127.0.0.1:5000/ <span class="o">(</span>Press CTRL+C to quit<span class="o">)</span></code></pre></figure>
<h2 id="locust-entre-en-jeu">Locust entre en jeu</h2>
<p>Locust permet de simuler de milliers d’utilisateurs simultanés sur notre app. Derrière le rideau, il crée un processus léger via gevent (plus précisément un <a href="http://www.gevent.org/api/gevent.greenlet.html">greenlet</a>) par utilisateur simulé. Ce choix technique permet de simuler un grand nombre d’usagers sur une seule machine.</p>
<p>Commençons par créer un fichier <code class="highlighter-rouge">locustfile.py</code>. Ce fichier servira pour décrire les tests de charge.</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="kn">from</span> <span class="nn">locust</span> <span class="kn">import</span> <span class="n">HttpLocust</span><span class="p">,</span> <span class="n">TaskSet</span><span class="p">,</span> <span class="n">task</span><span class="p">,</span> <span class="n">between</span>
<span class="k">class</span> <span class="nc">UserBehaviour</span><span class="p">(</span><span class="n">TaskSet</span><span class="p">):</span>
<span class="nd">@task</span>
<span class="k">def</span> <span class="nf">index</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">"/"</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">WebsiteUser</span><span class="p">(</span><span class="n">HttpLocust</span><span class="p">):</span>
<span class="n">task_set</span> <span class="o">=</span> <span class="n">UserBehaviour</span>
<span class="n">wait_time</span> <span class="o">=</span> <span class="n">between</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">9</span><span class="p">)</span></code></pre></figure>
<p>La class <code class="highlighter-rouge">UserBehaviour</code> nous permet de définir l’activité que les usagers vont mener. Dans notre cas il y a un seul et unique endpoint à la racine qu’on represente ici avec la fonction <code class="highlighter-rouge">index</code> décoré avec <code class="highlighter-rouge">@task</code> pour indiquer à Locust qu’il s’agit d’une tâche que les utilisateurs vont effectuer.</p>
<p>La class <code class="highlighter-rouge">WebsiteUser</code> represente l’utilisateur lui même. On spécifie la <code class="highlighter-rouge">task_set</code> qu’il réalisera ainsi que le temps qu’il attend entre chaque tâche - entre cinq et neuf secondes dans notre cas.</p>
<p>Si vous avez nommé ce fichier <code class="highlighter-rouge">locustfile.py</code> il suffit de taper <code class="highlighter-rouge">locust</code> dans la console pour tout démarrer. Si vous l’avez nommé différemment il faudra ajouter <code class="highlighter-rouge">-f <<path-to-file>></code></p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">» locust
<span class="o">[</span><date>] /INFO/locust.main: Starting web monitor at http://<span class="k">*</span>:8089
<span class="o">[</span><date>] /INFO/locust.main: Starting Locust 0.14.4</code></pre></figure>
<p>Locust a mis en place l’interface web sur <code class="highlighter-rouge">http://localhost:8089</code>. Cette interface nous permet de spécifier le nombre d’usagers à simuler, le taux de création de ces utilisateurs et l’URL de l’application à tester. Démarrons nos tests avec 100 utilisateurs avec un taux de croissance de dix par seconde. Vu que notre hello-world Flask tourne toujours sur le port <code class="highlighter-rouge">:5000</code> on peut le remplir comme cela :</p>
<p><img src="assets/images/locust-1.jpg" /></p>
<p>Après avoir appuyé sur le bouton <em>start swarming</em> le test se met en œuvre. Dans l’entête de la page on trouve le nombre d’utilisateurs simultanées, les requêtes par seconde (RPS) et le pourcentage d’échec. Plus bas, dans la table on peut aussi connaître le temps de réponse de notre application.</p>
<p>Notez aussi les onglets :</p>
<ul>
<li><em>Charts</em> contient des visualisations concernant les temps de réponse, les requêtes par seconde et le nombre d’usagers,</li>
<li><em>Failures</em> et <em>Exceptions</em> donne davantage d’information sur les problèmes rencontrés lors du test, et</li>
<li><em>Download Data</em> permet de télécharger les données bruts en CSV.</li>
</ul>
<p><img src="assets/images/locust-2.jpg" /></p>
<h2 id="plus-dendpoints">Plus d’endpoints</h2>
<p>Dans la vie réelle on voudra tester des applications qui ont plus d’un endpoint. Par exemple, on peut avoir de comptes utilisateur (et donc un <code class="highlighter-rouge">/login</code> et <code class="highlighter-rouge">/logout</code>). Puis on pourrait aussi mettre à disposition un endpoint pour paramétrer le compte (<code class="highlighter-rouge">/account</code>) ainsi qu’un autre pour accéder au panier d’achat (<code class="highlighter-rouge">/cart</code>).</p>
<p>Ajoutons ces nouvelles routes à notre app Flask sur <code class="highlighter-rouge">hello.py</code> :</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span>
<span class="n">app</span> <span class="o">=</span> <span class="n">Flask</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">'/'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">home</span><span class="p">():</span>
<span class="k">return</span> <span class="s">'Home'</span>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">'/login'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">home</span><span class="p">():</span>
<span class="k">return</span> <span class="s">'Login'</span>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">'/logout'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">home</span><span class="p">():</span>
<span class="k">return</span> <span class="s">'Logout'</span>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">'/account'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">home</span><span class="p">():</span>
<span class="k">return</span> <span class="s">'Account'</span>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">'/cart'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">home</span><span class="p">():</span>
<span class="k">return</span> <span class="s">'Cart'</span></code></pre></figure>
<h3 id="authentification">Authentification</h3>
<p>Cette fois-ci nos utilisateurs doivent s’identifier avant d’accéder aux autres pages. De plus, ils fermeront leur session après avoir fini. Les fonctions <code class="highlighter-rouge">on_start</code> et <code class="highlighter-rouge">on_stop</code> sont appelées avant l’exécution de la première tâche et après la fin du TaskSet respectivement. C’est donc idéal pour placer l’authentification :</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="o">...</span>
<span class="k">class</span> <span class="nc">UserBehaviour</span><span class="p">(</span><span class="n">TaskSet</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">on_start</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">'/login'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">on_stop</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">'/logout'</span><span class="p">)</span>
<span class="o">...</span></code></pre></figure>
<h3 id="comportement-des-usagers">Comportement des usagers</h3>
<p>Vu le nombre des pages dans notre app, ce serait utile de paramétrer <code class="highlighter-rouge">UserBehaviour</code> pour que les pages ne soient pas toutes visitées pareil. Nous pouvons nous attendre à que la page d’accueil (<code class="highlighter-rouge">/</code>) soit souvent visité. D’un autre côté, du fait que les utilisateurs ne paramètrent pas leur compte tous les jours, <code class="highlighter-rouge">/account</code> ne sera pas un passage obligé pour tous. Finalement, le panier d’achat (<code class="highlighter-rouge">/cart</code>) se situe un peu au milieu en terme d’affluence.</p>
<p>Pour ce faire on s’appuiera sur le décorateur <code class="highlighter-rouge">@task</code>, plus précisément sur son paramètre facultatif entier qui répresente le poids, çad la probabilité qu’un utilisateur choisisse la tâche en question pour son action suivante. Une tâche <code class="highlighter-rouge">@task(10)</code> a dix fois plus de probabilité d’être choisie qu’une tâche <code class="highlighter-rouge">@task(1)</code>. Nous pouvons donc récrire notre <code class="highlighter-rouge">locustfile.py</code> de la façon suivante :</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="kn">from</span> <span class="nn">locust</span> <span class="kn">import</span> <span class="n">HttpLocust</span><span class="p">,</span> <span class="n">TaskSet</span><span class="p">,</span> <span class="n">task</span><span class="p">,</span> <span class="n">between</span>
<span class="k">class</span> <span class="nc">UserBehaviour</span><span class="p">(</span><span class="n">TaskSet</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">on_start</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">'/login'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">on_stop</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">'/logout'</span><span class="p">)</span>
<span class="nd">@task</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">index</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">"/"</span><span class="p">)</span>
<span class="nd">@task</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">cart</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">"/cart"</span><span class="p">)</span>
<span class="nd">@task</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">account</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">"/account"</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">WebsiteUser</span><span class="p">(</span><span class="n">HttpLocust</span><span class="p">):</span>
<span class="n">task_set</span> <span class="o">=</span> <span class="n">UserBehaviour</span>
<span class="n">wait_time</span> <span class="o">=</span> <span class="n">between</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">9</span><span class="p">)</span></code></pre></figure>
<p>Si on applique les mêmes paramètres que lors du dernier test, on obtient ces résultats :</p>
<p><img src="assets/images/locust-3.jpg" /></p>
<p>On constate que chacun des 100 utilisateurs s’est identifié et a fini par fermer sa session. Le poids qu’on a assigné aux tâches a bien été respecté : la page d’accueil a été visité autour de dix fois plus que celle de paramétrage du compte et deux fois plus que le panier d’achat.</p>
<h2 id="locust-en-mode-distribuée">Locust en mode distribuée</h2>
<p>Si nos besoins de simulation sont trop importants pour être faits sur une seule machine, Locust permet d’exécuter les tests de façon distribuée. Il suffit de créer une instance Locust <em>master</em> (avec l’option <code class="highlighter-rouge">-master</code>) à laquelle on ajoutera des noeuds créés avec l’option <code class="highlighter-rouge">slave</code> et <code class="highlighter-rouge">---master-host</code> pour indiquer où se trouve l’instance maître.</p>
<p>Sur une machine on ferait :</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">locust <span class="nt">-f</span> mon_locustfile.py <span class="nt">--master</span></code></pre></figure>
<p>Et on ajouterait des noeuds avec :</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">locust <span class="nt">-f</span> mon_locustfile.py <span class="nt">--slave</span> <span class="nt">--master-host</span><span class="o">=</span>192.168.0.14</code></pre></figure>
<h2 id="en-conclusion">En conclusion</h2>
<p>Locust met à disposition des outils simples et puissants pour mesurer le comportement d’un système en fonction de la charge d’utilisateurs simultanés. La courbe d’apprentissage est particulièrement rapide, la documentation est claire et la flexibilité apportée par le choix de Python pour décrire les tests offre des vastes possibilités pour des cas spéciaux. L’interface graphique est plutôt basique, mais les données bruts sont disponibles pour ceux qui ont besoin de les traiter davantage.</p>
<p>J’ai mis en place Locust pour mon projet actuel et je ne peux que le recommander.</p>
<h3 id="comparaison-avec-jmeter">Comparaison avec JMeter</h3>
<p><a href="https://jmeter.apache.org/">JMeter</a> est basé sur Java et contient une interface graphique pour décrire nos tests, contrairement à Locust où on se sert du code Python. Je ne trouve pas leur UI très ergonomique : les cas d’usage de base sont plutôt difficiles à effectuer et souvent nécessitent des plugins externes pour fonctionner.</p>
<h3 id="comparaison-avec-tsung">Comparaison avec Tsung</h3>
<p><a href="http://tsung.erlang-projects.org/">Tsung</a> est basé sur Erlang et la machine virtuelle BEAM, un très bon choix pour une application basé sur des processus légers concurrents. Par contre, Tsung a besoin d’un fichier xml cauchemardesque pour décrire les tests. De plus, le projet a l’air plutôt dormant depuis un an.</p>
</div>
</section>
<!-- Email subscribe form at the bottom of the page -->
<footer class="post-full-footer">
<!-- Everything inside the #author tags pulls data from the author -->
<!-- #author-->
<!-- /author -->
</footer>
<!-- If you use Disqus comments, just uncomment this block.
The only thing you need to change is "test-apkdzgmqhj" - which
should be replaced with your own Disqus site-id. -->
<section class="post-full-comments">
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = 'http://alemangui.github.io/locust';
this.page.identifier = '/locust';
};
(function() {
var d = document, s = d.createElement('script');
s.src = 'https://alemanguisblog.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
</section>
</article>
</div>
</main>
<!-- Links to Previous/Next posts -->
<aside class="read-next outer">
<div class="inner">
<div class="read-next-feed">
<article class="read-next-card"
style="background-image: url(/assets/images/dark-sand.jpg)"
>
<header class="read-next-card-header">
<small class="read-next-card-header-sitetitle">— Alejandro Mantecón Guillén —</small>
<h3 class="read-next-card-header-title"><a href="/tag/développement/">Développement</a></h3>
</header>
<div class="read-next-divider"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 14.5s2 3 5 3 5.5-2.463 5.5-5.5S21 6.5 18 6.5c-5 0-7 11-12 11C2.962 17.5.5 15.037.5 12S3 6.5 6 6.5s4.5 3.5 4.5 3.5"/></svg>
</div>
<div class="read-next-card-content">
<ul>
<li><a href="/tests-automatiques-avec-autoplay">Tests automatiques avec autoplay</a></li>
</ul>
</div>
<footer class="read-next-card-footer">
<a href="/tag/développement/">
See all 1 posts →
</a>
</footer>
</article>
<!-- If there's a next post, display it using the same markup included from - partials/post-card.hbs -->
<article class="post-card post-template">
<a class="post-card-image-link" href="/apple-et-le-droit-a-la-reparation">
<div class="post-card-image" style="background-image: url(/assets/images/repair.jpg)"></div>
</a>
<div class="post-card-content">
<a class="post-card-content-link" href="/apple-et-le-droit-a-la-reparation">
<header class="post-card-header">
<span class="post-card-tags">Société</span>
<span class="post-card-tags">Environnement</span>
<h2 class="post-card-title">Apple et le droit à la réparation</h2>
</header>
<section class="post-card-excerpt">
<p></p>
</section>
</a>
<footer class="post-card-meta">
<span class="reading-time">
1 min read
</span>
</footer>
</div>
</article>
<!-- If there's a previous post, display it using the same markup included from - partials/post-card.hbs -->
<article class="post-card post-template">
<a class="post-card-image-link" href="/ramp-to-value">
<div class="post-card-image" style="background-image: url(/assets/images/mixer.jpg)"></div>
</a>
<div class="post-card-content">
<a class="post-card-content-link" href="/ramp-to-value">
<header class="post-card-header">
<span class="post-card-tags">Web audio</span>
<span class="post-card-tags">Js</span>
<h2 class="post-card-title">Web Audio: the ugly click and the human ear</h2>
</header>
<section class="post-card-excerpt">
<p></p>
</section>
</a>
<footer class="post-card-meta">
<span class="reading-time">
1 min read
</span>
</footer>
</div>
</article>
</div>
</div>
</aside>
<!-- Floating header which appears on-scroll, included from includes/floating-header.hbs -->
<div class="floating-header">
<div class="floating-header-logo">
<a href="http://alemangui.github.io/">
<img src="/assets/images/favicon.png" alt="Alejandro Mantecón Guillén icon" />
<span>Alejandro Mantecón Guillén</span>
</a>
</div>
<span class="floating-header-divider">—</span>
<div class="floating-header-title">Mesurer la performance avec Locust</div>
<div class="floating-header-share">
<div class="floating-header-share-label">Partagez cet article <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M7.5 15.5V4a1.5 1.5 0 1 1 3 0v4.5h2a1 1 0 0 1 1 1h2a1 1 0 0 1 1 1H18a1.5 1.5 0 0 1 1.5 1.5v3.099c0 .929-.13 1.854-.385 2.748L17.5 23.5h-9c-1.5-2-5.417-8.673-5.417-8.673a1.2 1.2 0 0 1 1.76-1.605L7.5 15.5zm6-6v2m-3-3.5v3.5m6-1v2"/>
</svg>
</div>
<a class="floating-header-share-tw" href="https://twitter.com/share?text=Mesurer+la+performance+avec+Locust&url=https://alemangui.github.io/locust"
onclick="window.open(this.href, 'share-twitter', 'width=550,height=235');return false;">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M30.063 7.313c-.813 1.125-1.75 2.125-2.875 2.938v.75c0 1.563-.188 3.125-.688 4.625a15.088 15.088 0 0 1-2.063 4.438c-.875 1.438-2 2.688-3.25 3.813a15.015 15.015 0 0 1-4.625 2.563c-1.813.688-3.75 1-5.75 1-3.25 0-6.188-.875-8.875-2.625.438.063.875.125 1.375.125 2.688 0 5.063-.875 7.188-2.5-1.25 0-2.375-.375-3.375-1.125s-1.688-1.688-2.063-2.875c.438.063.813.125 1.125.125.5 0 1-.063 1.5-.25-1.313-.25-2.438-.938-3.313-1.938a5.673 5.673 0 0 1-1.313-3.688v-.063c.813.438 1.688.688 2.625.688a5.228 5.228 0 0 1-1.875-2c-.5-.875-.688-1.813-.688-2.75 0-1.063.25-2.063.75-2.938 1.438 1.75 3.188 3.188 5.25 4.25s4.313 1.688 6.688 1.813a5.579 5.579 0 0 1 1.5-5.438c1.125-1.125 2.5-1.688 4.125-1.688s3.063.625 4.188 1.813a11.48 11.48 0 0 0 3.688-1.375c-.438 1.375-1.313 2.438-2.563 3.188 1.125-.125 2.188-.438 3.313-.875z"/></svg>
</a>
<a class="floating-header-share-fb" href="https://www.facebook.com/sharer/sharer.php?u=https://alemangui.github.io/locust"
onclick="window.open(this.href, 'share-facebook','width=580,height=296');return false;">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M19 6h5V0h-5c-3.86 0-7 3.14-7 7v3H8v6h4v16h6V16h5l1-6h-6V7c0-.542.458-1 1-1z"/></svg>
</a>
</div>
<progress class="progress" value="0">
<div class="progress-container">
<span class="progress-bar"></span>
</div>
</progress>
</div>
<!-- /post -->
<!-- The #contentFor helper here will send everything inside it up to the matching #block helper found in default.hbs -->
<!-- Previous/next page links - displayed on every page -->
<!-- The footer at the very bottom of the screen -->
<footer class="site-footer outer">
<div class="site-footer-content inner">
<section class="copyright"><a href="http://alemangui.github.io/">Alejandro Mantecón Guillén</a> © 2020</section>
<nav class="site-footer-nav">
<a class="social-link social-link-tw" href="https://twitter.com/alemangui" target="_blank" rel="noopener"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M30.063 7.313c-.813 1.125-1.75 2.125-2.875 2.938v.75c0 1.563-.188 3.125-.688 4.625a15.088 15.088 0 0 1-2.063 4.438c-.875 1.438-2 2.688-3.25 3.813a15.015 15.015 0 0 1-4.625 2.563c-1.813.688-3.75 1-5.75 1-3.25 0-6.188-.875-8.875-2.625.438.063.875.125 1.375.125 2.688 0 5.063-.875 7.188-2.5-1.25 0-2.375-.375-3.375-1.125s-1.688-1.688-2.063-2.875c.438.063.813.125 1.125.125.5 0 1-.063 1.5-.25-1.313-.25-2.438-.938-3.313-1.938a5.673 5.673 0 0 1-1.313-3.688v-.063c.813.438 1.688.688 2.625.688a5.228 5.228 0 0 1-1.875-2c-.5-.875-.688-1.813-.688-2.75 0-1.063.25-2.063.75-2.938 1.438 1.75 3.188 3.188 5.25 4.25s4.313 1.688 6.688 1.813a5.579 5.579 0 0 1 1.5-5.438c1.125-1.125 2.5-1.688 4.125-1.688s3.063.625 4.188 1.813a11.48 11.48 0 0 0 3.688-1.375c-.438 1.375-1.313 2.438-2.563 3.188 1.125-.125 2.188-.438 3.313-.875z"/></svg>
</a>
<a class="social-link social-link-tw" href="https://codepen.io/alemangui" target="_blank" rel="noopener"><?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 32.768 32.768" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><metadata><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/><dc:title/></cc:Work></rdf:RDF></metadata><defs><clipPath id="b"><path d="m0 500h500v-500h-500z"/></clipPath><filter id="a" x="-.012" y="-.012" width="1.024" height="1.024" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="2.3454725"/></filter></defs><g transform="matrix(.068217 0 0 -.068216 -.63927 33.469)" filter="url(#a)"><g clip-path="url(#b)"><g transform="matrix(1.631 0 0 1.631 445.42 216.43)"><path d="m0 0-31.18 20.858 31.18 20.857zm-107.63-88.412v58.133l54.035 36.138 43.619-29.172zm-12.462 79.784-44.084 29.486 44.084 29.486 44.08-29.486zm-12.466-79.784-97.655 65.099 43.623 29.172 54.032-36.138zm-107.63 130.13 31.183-20.857-31.183-20.858zm107.63 88.413v-58.133l-54.032-36.146-43.623 29.181zm24.928 0 97.654-65.098-43.619-29.181-54.035 36.146zm132.45-63.458c-0.026 0.183-0.072 0.358-0.102 0.541-0.062 0.352-0.126 0.703-0.218 1.046-0.054 0.206-0.13 0.404-0.194 0.602-0.1 0.306-0.199 0.611-0.321 0.908-0.085 0.206-0.183 0.412-0.278 0.61-0.131 0.283-0.267 0.558-0.424 0.824-0.114 0.199-0.236 0.39-0.354 0.58-0.168 0.26-0.34 0.512-0.528 0.756-0.136 0.183-0.281 0.366-0.426 0.542-0.199 0.228-0.405 0.457-0.622 0.671-0.163 0.167-0.325 0.335-0.496 0.488-0.229 0.206-0.465 0.405-0.706 0.595-0.186 0.145-0.37 0.29-0.564 0.427-0.073 0.046-0.137 0.107-0.206 0.153l-132.56 88.374c-4.187 2.792-9.639 2.792-13.827 0l-132.56-88.374c-0.069-0.046-0.134-0.107-0.206-0.153-0.195-0.137-0.378-0.282-0.561-0.427-0.244-0.19-0.481-0.389-0.705-0.595-0.176-0.153-0.336-0.321-0.5-0.488-0.217-0.214-0.423-0.443-0.618-0.671-0.149-0.176-0.294-0.359-0.431-0.542-0.183-0.244-0.359-0.496-0.523-0.756-0.126-0.19-0.244-0.381-0.358-0.58-0.153-0.266-0.29-0.541-0.424-0.824-0.095-0.198-0.194-0.404-0.278-0.61-0.122-0.297-0.221-0.602-0.321-0.908-0.065-0.198-0.137-0.396-0.194-0.602-0.092-0.343-0.153-0.694-0.218-1.046-0.03-0.183-0.076-0.358-0.099-0.541-0.073-0.534-0.114-1.076-0.114-1.625v-88.374c0-0.549 0.041-1.091 0.114-1.633 0.023-0.176 0.069-0.358 0.099-0.533 0.065-0.352 0.126-0.702 0.218-1.046 0.057-0.206 0.129-0.404 0.194-0.603 0.1-0.304 0.199-0.61 0.321-0.915 0.084-0.207 0.183-0.405 0.278-0.603 0.134-0.281 0.271-0.556 0.424-0.831 0.114-0.192 0.232-0.381 0.358-0.572 0.164-0.26 0.34-0.512 0.523-0.756 0.137-0.191 0.282-0.366 0.431-0.541 0.195-0.229 0.401-0.458 0.618-0.672 0.164-0.167 0.324-0.335 0.5-0.487 0.224-0.208 0.461-0.406 0.705-0.596 0.183-0.146 0.366-0.29 0.561-0.427 0.072-0.046 0.137-0.107 0.206-0.152l132.56-88.375c2.094-1.396 4.505-2.098 6.916-2.098 2.407 0 4.817 0.702 6.911 2.098l132.56 88.375c0.069 0.045 0.133 0.106 0.206 0.152 0.194 0.137 0.378 0.281 0.564 0.427 0.241 0.19 0.477 0.388 0.706 0.596 0.171 0.152 0.333 0.32 0.496 0.487 0.217 0.214 0.423 0.443 0.622 0.672 0.145 0.175 0.29 0.35 0.426 0.541 0.188 0.244 0.36 0.496 0.528 0.756 0.118 0.191 0.24 0.38 0.354 0.572 0.157 0.275 0.293 0.55 0.424 0.831 0.095 0.198 0.193 0.396 0.278 0.603 0.122 0.305 0.221 0.611 0.321 0.915 0.064 0.199 0.14 0.397 0.194 0.603 0.092 0.344 0.156 0.694 0.218 1.046 0.03 0.175 0.076 0.357 0.102 0.533 0.069 0.542 0.112 1.084 0.112 1.633v88.374c0 0.549-0.043 1.091-0.112 1.625"/></g></g></g></svg>
</a>
<a class="social-link social-link-tw" href="https://linkedin.com/in/alemangui" target="_blank" rel="noopener"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z"/></svg></a>
<a class="social-link social-link-tw" href="https://github.com/alemangui" target="_blank" rel="noopener"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/></svg></a>
<a class="social-link social-link-tw" href="https://stackoverflow.com/users/1046444" target="_blank" rel="noopener"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M15 21h-10v-2h10v2zm6-11.665l-1.621-9.335-1.993.346 1.62 9.335 1.994-.346zm-5.964 6.937l-9.746-.975-.186 2.016 9.755.879.177-1.92zm.538-2.587l-9.276-2.608-.526 1.954 9.306 2.5.496-1.846zm1.204-2.413l-8.297-4.864-1.029 1.743 8.298 4.865 1.028-1.744zm1.866-1.467l-5.339-7.829-1.672 1.14 5.339 7.829 1.672-1.14zm-2.644 4.195v8h-12v-8h-2v10h16v-10h-2z"/></svg></a>
<a class="social-link social-link-tw" href="https://www.instagram.com/alemangui" target="_blank" rel="noopener"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z"/></svg></a>
</nav>
</div>
</footer>
</div>
<!-- The big email subscribe modal content -->
<!-- highlight.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.10.0/components/prism-abap.min.js"></script>
<script>$(document).ready(function() {
$('pre code').each(function(i, block) {
hljs.highlightBlock(block);
});
});</script>
<!-- jQuery + Fitvids, which makes all video embeds responsive -->
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous">
</script>
<script type="text/javascript" src="/assets/js/jquery.fitvids.js"></script>
<!-- Paginator increased to "infinit" in _config.yml -->
<!-- if paginator.posts -->
<!-- <script>
var maxPages = parseInt('');
</script>
<script src="/assets/js/infinitescroll.js"></script> -->
<!-- /endif -->
<!-- Add Google Analytics -->
<!-- Google Analytics Tracking code -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-25705162-1', 'auto');
ga('send', 'pageview');
</script>
<!-- The #block helper will pull in data from the #contentFor other template files. In this case, there's some JavaScript which we only want to use in post.hbs, but it needs to be included down here, after jQuery has already loaded. -->
<script>
// NOTE: Scroll performance is poor in Safari
// - this appears to be due to the events firing much more slowly in Safari.
// Dropping the scroll event and using only a raf loop results in smoother
// scrolling but continuous processing even when not scrolling
$(document).ready(function () {
// Start fitVids
var $postContent = $(".post-full-content");
$postContent.fitVids();
// End fitVids
var progressBar = document.querySelector('progress');
var header = document.querySelector('.floating-header');
var title = document.querySelector('.post-full-title');
var lastScrollY = window.scrollY;
var lastWindowHeight = window.innerHeight;
var lastDocumentHeight = $(document).height();
var ticking = false;
function onScroll() {
lastScrollY = window.scrollY;
requestTick();
}
function onResize() {
lastWindowHeight = window.innerHeight;
lastDocumentHeight = $(document).height();
requestTick();
}
function requestTick() {
if (!ticking) {
requestAnimationFrame(update);
}
ticking = true;
}
function update() {
var trigger = title.getBoundingClientRect().top + window.scrollY;
var triggerOffset = title.offsetHeight + 35;
var progressMax = lastDocumentHeight - lastWindowHeight;
// show/hide floating header
if (lastScrollY >= trigger + triggerOffset) {
header.classList.add('floating-active');
} else {
header.classList.remove('floating-active');
}
progressBar.setAttribute('max', progressMax);
progressBar.setAttribute('value', lastScrollY);
ticking = false;
}
window.addEventListener('scroll', onScroll, {passive: true});
window.addEventListener('resize', onResize, false);
update();
});
</script>
<!-- Ghost outputs important scripts and data with this tag - it should always be the very last thing before the closing body tag -->
<!-- ghost_foot -->
</body>
</html>