橘向日葵
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    Locust to Go, Kubernetes to Load === <!-- .slide: data-background="pink" --> <!-- .slide: data-transition="zoom" --> "Go" to "load" test :dizzy: > [name=郭學聰 Hsueh-Tsung Kuo] [time=Sat, 11 Aug 2018] [color=red] --- <!-- .slide: data-transition="convex" --> ## who am I? ![fieliapm](https://pbs.twimg.com/profile_images/591670980021387264/aZAYLRUe_400x400.png) ---- <!-- .slide: data-transition="convex" --> * programmer from Rayark, a game company in Taiwan * backend engineer, focus on common service * usually develop something related to my work in Python, Ruby, Golang, C# * built almost entire VOEZ game server by myself only * supported Sdorica backend development --- <!-- .slide: data-transition="convex" --> ## outline ---- <!-- .slide: data-transition="convex" --> 4. Locust <- Python 1. Locust? 2. usage 5. Locust -> Go 1. interoperability 2. boomer 6. play http service 7. docker & Kubernetes 1. docker 2. Kubernetes ---- <!-- .slide: data-transition="convex" --> 8. live coding 9. conclusion 10. commercial 11. Q&A --- <!-- .slide: data-transition="convex" --> ## Locust <- Python ---- <!-- .slide: data-transition="convex" --> ### Locust? ---- <!-- .slide: data-transition="convex" --> ![locust](https://upload.wikimedia.org/wikipedia/commons/thumb/2/25/Locusta-migratoria-wanderheuschrecke.jpg/1280px-Locusta-migratoria-wanderheuschrecke.jpg =800x559) ---- <!-- .slide: data-transition="convex" --> ### Locust? * official website: https://locust.io/ * Define user behaviour with Python code, and swarm your system with millions of simultaneous users. ---- <!-- .slide: data-transition="convex" --> #### framework ```graphviz digraph locust { nodesep=1.0 // increases the separation between nodes node [color="red" shape=box] edge [color="blue" style=dashed] master [label="master (coordinator)"] client1 [label="client 1...n" shape="oval"] client2 [label="client 1...n" shape="oval"] client3 [label="client 1...n" shape="oval"] master->slave1 master->slave2 master->slave3 slave1->client1 [style=solid] slave2->client2 [style=solid] slave3->client3 [style=solid] client1->server client1->server client1->server client1->server client1->server client2->server client2->server client2->server client2->server client2->server client3->server client3->server client3->server client3->server client3->server } ``` ---- <!-- .slide: data-transition="convex" --> #### why slave? * one client vs Google Cloud load balancer * :x: client lose * connections limitation * file descriptors limitation * many clients vs Google Cloud load balancer * :o: client may win * ==**大家一起上!**== <!-- .element: class="fragment" data-fragment-index="2" --> ---- <!-- .slide: data-transition="convex" --> ### usage ---- <!-- .slide: data-transition="convex" --> #### install ```shell pip install locustio ``` ---- <!-- .slide: data-transition="convex" --> run Locust distributed across multiple processes/machines ```shell pip install pyzmq ``` <!-- .element: class="fragment" data-fragment-index="1" --> ---- <!-- .slide: data-transition="convex" --> #### code (simple) ```python= from locust import HttpLocust, TaskSet, task class WebsiteTasks(TaskSet): def on_start(self): self.client.post("/login", { "username": "test_user", "password": "" }) @task def index(self): self.client.get("/") @task def about(self): self.client.get("/about/") class WebsiteUser(HttpLocust): task_set = WebsiteTasks min_wait = 5000 max_wait = 15000 ``` ---- <!-- .slide: data-transition="convex" --> #### code (assign weight) ```python= from locust import HttpLocust, TaskSet, task class WebsiteTasks(TaskSet): def on_start(self): self.client.post("/login", { "username": "test_user", "password": "" }) @task(100) def index(self): self.client.get("/") @task(7) def about(self): self.client.get("/about/") class WebsiteUser(HttpLocust): task_set = WebsiteTasks min_wait = 5000 max_wait = 15000 ``` ---- <!-- .slide: data-transition="convex" --> #### build & run ```shell locust -f locustfile.py --host=http://example.com ``` ---- <!-- .slide: data-transition="convex" --> #### monitoring ![monitoring](https://locust.io/static/img/screenshot.png) --- <!-- .slide: data-transition="convex" --> ## Locust -> Go ---- <!-- .slide: data-transition="convex" --> ### interoperability * Python? * define tasks out of the box (standalone mode) * foreign language? * ZeroMQ (master/slave mode) <!-- .element: class="fragment" data-fragment-index="1" --> ---- <!-- .slide: data-transition="convex" --> ```sequence locust master->locust slave: ZeroMQ: make a request note left of locust slave: log start time locust slave->server: HTTP request server->locust slave: HTTP response note left of locust slave: log end time note left of locust slave: detect response status locust slave->locust master: ZeroMQ: report status ``` ---- <!-- .slide: data-transition="convex" --> #### why Go? * fast <!-- .element: class="fragment" data-fragment-index="1" --> * faster <!-- .element: class="fragment" data-fragment-index="2" --> * fastest <!-- .element: class="fragment" data-fragment-index="3" --> ---- <!-- .slide: data-transition="convex" --> #### why Go? * server is written with Go * client bots written with Python cannot be as fast as Go ---- <!-- .slide: data-transition="convex" --> ### boomer * boomer: https://github.com/myzhan/boomer * Go module * load generator for Locust * be a slave * connect with Locust master via ZeroMQ * dependency: * https://github.com/zeromq/gomq ---- <!-- .slide: data-transition="convex" --> #### code (simple) `dummy.py` ```python= # -*- coding: utf-8 -*- from locust import Locust, TaskSet, task class MyTaskSet(TaskSet): @task(20) def hello(self): pass class Dummy(Locust): task_set = MyTaskSet ``` ---- <!-- .slide: data-transition="convex" --> `main.go` ```go= package main import "github.com/myzhan/boomer" import "time" func foo() { start := boomer.Now() time.Sleep(100 * time.Millisecond) elapsed := boomer.Now() - start // Report your test result as a success, if you write it in python, it will looks like this // events.request_success.fire(request_type="http", name="foo", response_time=100, response_length=10) boomer.Events.Publish("request_success", "http", "foo", elapsed, int64(10)) } ``` ---- <!-- .slide: data-transition="convex" --> `main.go` ```go= func bar() { start := boomer.Now() time.Sleep(100 * time.Millisecond) elapsed := boomer.Now() - start // Report your test result as a failure, if you write it in python, it will looks like this // events.request_failure.fire(request_type="udp", name="bar", response_time=100, exception=Exception("udp error")) boomer.Events.Publish("request_failure", "udp", "bar", elapsed, "udp error") } ``` ---- <!-- .slide: data-transition="convex" --> `main.go` ```go= func main() { task1 := &boomer.Task{ Name: "foo", Weight: 10, Fn: foo, } task2 := &boomer.Task{ Name: "bar", Weight: 20, Fn: bar, } boomer.Run(task1, task2) } ``` ---- <!-- .slide: data-transition="convex" --> #### finite state machine * randomized * finance * social network * \.\.\.\.\.\. etc * ordered * game ---- <!-- .slide: data-transition="convex" --> #### code (finite state machine) `main_seq.go` ```go= package main import "github.com/myzhan/boomer" import "time" func foobar(){ start := boomer.Now() time.Sleep(100 * time.Millisecond) elapsed := boomer.Now() - start // Report your test result as a success, if you write it in python, it will looks like this // events.request_success.fire(request_type="http", name="foo", response_time=100, response_length=10) boomer.Events.Publish("request_success", "http", "foo", elapsed, int64(10)) start = boomer.Now() time.Sleep(100 * time.Millisecond) elapsed = boomer.Now() - start // Report your test result as a failure, if you write it in python, it will looks like this // events.request_failure.fire(request_type="udp", name="bar", response_time=100, exception=Exception("udp error")) boomer.Events.Publish("request_failure", "udp", "bar", elapsed, "udp error") } ``` ---- <!-- .slide: data-transition="convex" --> `main_seq.go` ```go= func main(){ sequencialTask1 := &boomer.Task{ Name: "foobar1", Weight: 10, Fn: foobar, } sequencialTask2 := &boomer.Task{ Name: "foobar2", Weight: 20, Fn: foobar, } boomer.Run(sequencialTask1, sequencialTask2) } ``` ---- <!-- .slide: data-transition="convex" --> #### run as stand alone process (for debug) ```shell go build -o a.out main.go ./a.out --run-tasks foo,bar ``` ---- <!-- .slide: data-transition="convex" --> #### run as slave mode ```shell locust -f dummy.py --master --master-bind-host=127.0.0.1 --master-bind-port=5557 go build -o a.out main.go ./a.out --master-host=127.0.0.1 --master-port=5557 --rpc=zeromq ``` --- <!-- .slide: data-transition="convex" --> ## play http service ---- <!-- .slide: data-transition="convex" --> ```go= resp, err := http.Get("http://example.com/") ... resp, err := http.Post("http://example.com/upload", "image/jpeg", &buf) ... resp, err := http.PostForm("http://example.com/form", url.Values{"key": {"Value"}, "id": {"123"}}) ``` ---- <!-- .slide: data-transition="convex" --> ```go= func exampleGet() { start := boomer.Now() resp, err := http.Get("https://dl.google.com/go/go1.10.3.src.tar.gz") //resp, err := http.Get("https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.gz") if err == nil { func() { defer resp.Body.Close() _, err = ioutil.ReadAll(resp.Body) }() } elapsed := boomer.Now() - start if err == nil { boomer.Events.Publish("request_success", "http", "example_get", elapsed, resp.ContentLength) } else { boomer.Events.Publish("request_failure", "http", "example_get", elapsed, err.Error()) } } ``` --- <!-- .slide: data-transition="convex" --> ## docker & Kubernetes ---- <!-- .slide: data-transition="convex" --> ### docker ---- <!-- .slide: data-transition="convex" --> ### docker * multiple machine * break connections limitation * break file descriptors limitation * multiple docker instance * break limitation * **easy scale** <!-- .element: class="fragment" data-fragment-index="1" --> ---- <!-- .slide: data-transition="convex" --> ### Kubernetes ---- <!-- .slide: data-transition="convex" --> ### Kubernetes * ~~kill~~ control them all!! ---- <!-- .slide: data-transition="convex" --> ### Kubernetes ![kubernetes](https://d33wubrfki0l68.cloudfront.net/1567471e7c58dc9b7d9c65dcd54e60cbf5870daa/a2249/images/flower.png) ---- <!-- .slide: data-transition="convex" --> #### kubectl scale --replicas=1 locust-slave ```graphviz digraph locust { nodesep=1.0 // increases the separation between nodes node [color="red" shape=box] edge [color="blue" style=dashed] master [label="master (coordinator)"] client1 [label="client 1...n" shape="oval"] master->slave1 slave1->client1 [style=solid] client1->server client1->server client1->server client1->server client1->server } ``` ---- <!-- .slide: data-transition="convex" --> #### kubectl scale --replicas=2 locust-slave ```graphviz digraph locust { nodesep=1.0 // increases the separation between nodes node [color="red" shape=box] edge [color="blue" style=dashed] master [label="master (coordinator)"] client1 [label="client 1...n" shape="oval"] client2 [label="client 1...n" shape="oval"] master->slave1 master->slave2 slave1->client1 [style=solid] slave2->client2 [style=solid] client1->server client1->server client1->server client1->server client1->server client2->server client2->server client2->server client2->server client2->server } ``` ---- <!-- .slide: data-transition="convex" --> #### kubectl scale --replicas=3 locust-slave ```graphviz digraph locust { nodesep=1.0 // increases the separation between nodes node [color="red" shape=box] edge [color="blue" style=dashed] master [label="master (coordinator)"] client1 [label="client 1...n" shape="oval"] client2 [label="client 1...n" shape="oval"] client3 [label="client 1...n" shape="oval"] master->slave1 master->slave2 master->slave3 slave1->client1 [style=solid] slave2->client2 [style=solid] slave3->client3 [style=solid] client1->server client1->server client1->server client1->server client1->server client2->server client2->server client2->server client2->server client2->server client3->server client3->server client3->server client3->server client3->server } ``` --- <!-- .slide: data-transition="convex" --> ## live coding ---- <!-- .slide: data-transition="convex" --> never live coding ¯\\\_\(ツ\)\_/¯ ---- <!-- .slide: data-transition="convex" --> ~~never~~ live coding ( O\_o) ? ---- <!-- .slide: data-transition="convex" --> 重新定義 "living" live coding ( @д@) ! ---- <!-- .slide: data-transition="convex" --> just do it ( >ω•)b --- <!-- .slide: data-transition="convex" --> ## conclusion ---- <!-- .slide: data-transition="convex" --> > :hash: "倒站即進化" > [name=郭學聰 Hsueh-Tsung Kuo] [time=2018_08_11] [color=red] ---- <!-- .slide: data-transition="convex" --> ### special thanks * backend: yuxioz, bluesky * SRE: haraguroicha, hyww, mswu * QA: xible * others --- <!-- .slide: data-transition="zoom" --> ## commercial Sdorica -sunset- * <small>OP Animation https://youtu.be/ktGRO8tCBqs</small> * <small>Global Launch Trailer https://youtu.be/2aY7il7zuNk</small> * <small>Background Story https://youtu.be/9tOmgueeY7I</small> ---- <!-- .slide: data-transition="zoom" --> {%youtube ktGRO8tCBqs %} ---- <!-- .slide: data-transition="zoom" --> # Rayark Wants You ! Rayark Careers | Make A Difference * EN https://careers.rayark.com/jobs/ * ZH https://careers.rayark.com/zh/jobs/ ---- <!-- .slide: data-transition="zoom" --> # Meet Rayark in COSCUP 攤位區 * 產品展示 * 精美小物 --- <!-- .slide: data-transition="zoom" --> ## Q&A --- <style> .reveal { background: #FFDFEF; color: black; } .reveal h2, .reveal h3, .reveal h4 { color: black; } .reveal code { font-size: 14px !important; line-height: 1.2; } .rightpart{ float:right; width:50%; } .leftpart{ margin-right: 50% !important; height:50%; } .reveal section img { background:none; border:none; box-shadow:none; } p.blo { font-size: 50px !important; background:#B6BDBB; border:1px solid silver; display:inline-block; padding:0.5em 0.75em; border-radius: 10px; box-shadow: 5px 5px 5px #666; } p.blo1 { background: #c7c2bb; } p.blo2 { background: #b8c0c8; } p.blo3 { background: #c7cedd; } p.bloT { font-size: 60px !important; background:#B6BDD3; border:1px solid silver; display:inline-block; padding:0.5em 0.75em; border-radius: 8px; box-shadow: 1px 2px 5px #333; } p.bloA { background: #B6BDE3; } p.bloB { background: #E3BDB3; } .slide-number{ margin-bottom:10px !important; width:100%; text-align:center; font-size:25px !important; background-color:transparent !important; } iframe.myclass{ width:100px; height:100px; bottom:0; left:0; position:fixed; border:none; z-index:99999; } h1.raw { color: #fff; background-image: linear-gradient(90deg,#f35626,#feab3a); -webkit-background-clip: text; -webkit-text-fill-color: transparent; animation: hue 5s infinite linear; } @keyframes hue { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } } .progress{ height:14px !important; } .progress span{ height:14px !important; background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAMCAIAAAAs6UAAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSRE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qrU9joX21Q0IUElm7DQkAOw==') !important; width: 34px !important; height: 21px !important; border: none !important; float:right; margin-top:-7px; margin-right:-10px; } </style>

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully