Changeset 18318 for docs

Show
Ignore:
Timestamp:
08/27/08 19:56:31 (3 months ago)
Author:
tokuhirom
Message:

added slides

Location:
docs/tokuhirom/20080827-microblogcon-jobqueue
Files:
1 modified
1 copied

Legend:

Unmodified
Added
Removed
  • docs/tokuhirom/20080827-microblogcon-jobqueue/main.txt

    r14649 r18318  
    1 Perl5VM Golf 
     1Queueueueueue 
    22<div style="text-align: right"> 
    3 2008-06-25(Wed) XS Nite 
    4 Mobile Factory Inc. 
    5 Tokuhiro Matsuno 
     32008-08-27(Wed) MicroBlogCon#1 
     4tokuhirom 
    65</div> 
    76---- 
    8 *VM Golf? 
     7焦点。 
     8Gearman/TheSchwartz と Q4M 
    99---- 
    10 perl5 has 
    11 Virtual Machine 
     10随時ツッコミ歓迎 
     11(主に id:kazuhooku の) 
    1212---- 
    13 Virtual Machine 
    14 has 
    15 OP Code 
     13Gearman 
    1614---- 
    17 OP Code 
    18  
    19 総和 
    20 (Sum of opcode) 
     15client, gearmand, worker 
     16---- 
     17gearmand 
     18- Gearman::Server 
     19- pure perl 
     20- binary protocol 
     21- store jobs on memory 
     22---- 
     23Gearman::Worker 
     24- select(2) でまってるからリアルタイムだョ 
     25---- 
     26Gearman::Client 
     27- perl, ruby, python 
     28---- 
     29Gearman::Client::Async 
     30- Danga::Socket 
     31- epoll(2)/kqueue(2)/select(2) 
     32- 非同期に結果をうけとれる 
     33- DJabberd 
     34-- based on Danga::Socket 
     35-- XMPP Server 
     36---- 
     37用途 
     38- Danga::Socket な鯖でブロッキング(DJabberd) 
     39- ヒトコトを投稿したときのフック 
     40---- 
     41フックでやること多すぎにつき 
     42- IM に通知 
     43- fav otsune 
     44- リアルタイムで処理したいけど、Apache ではやるほどのこともない 
     45---- 
     46TheSchwartz 
     47---- 
     48- reliable job queue 
     49- MySQL にがんばるの術 
     50- インストール楽すぎる 
     51---- 
     52reliable? 
     53---- 
     54Yes! Gearman is not a reliable! 
     55- 落ちちゃうときもある 
     56- お茶目な存在 
     57---- 
     58実装 
     59- 1秒に一回ぐらい SQL うってジョブないかみてる 
     60---- 
     61用途 
     62- Feed の生成 
     63- 画像ブログパーツのさくせい 
     64- cron のスクリプト 
     65- gearman → TheSchwartz 
     66- etc. 
     67---- 
     68Perl モジュールの読み込みおそいよー >< 
     69そこで TheSchwartz 
     70---- 
     71ポイント 
     72- リアルタイム性がない 
     73- 信頼できる男。MySQL 
     74---- 
     75Q4M 
     76---- 
     77持続的な非同期コミュニケーションのための 
     78ミドルウェア 
     79---- 
     80MySQL5.1 storage engine 
    2181---- 
    2282>|| 
    23 0   null      OP_NULL      null operation 
    24 1   stub      OP_STUB      stub 
    25 2   scalar    OP_SCALAR    scalar 
    26 3   pushmark  OP_PUSHMARK  pushmark 
    27 4   wantarray OP_WANTARRAY wantarray 
    28 5   const     OP_CONST     constant item 
    29 6   gvsv      OP_GVSV      scalar variable 
    30 7   gv        OP_GV        glob value 
    31 8   gelem     OP_GELEM     glob elem 
    32 9   padsv     OP_PADSV     private variable 
    33 10  padav     OP_PADAV     private array 
    34 11  padhv     OP_PADHV     private hash 
    35 12  padany    OP_PADANY    private value 
    36 13  pushre    OP_PUSHRE    push regexp 
    37 14  rv2gv     OP_RV2GV     ref-to-glob cast 
    38 ... 
     83while (1) { 
     84    SELECT queue_wait('queue'); # XXX block! 
     85    my @row = SELECT ROW * FROM queue or next; 
     86    # snip 
     87} 
    3988||< 
    4089---- 
    41 めざすスコアぴったりをねらう 
    42 バイト数をへらす 
    43 (short code is good) 
     90Q4Mでしかできないこと 
     91- キューの (reliable) forward 
     92- 特定のフィールドの条件を指定した conditional subscription 
     93ってあたりになるのかなぁ 
     94(id:kazuhooku 談) 
    4495---- 
    45 *1000op 
     96みんな Q4M つかえばいいよ! 
    4697---- 
    47 "n"+"i"+"p"+"o"+"t"-"a"<<$$$n 
    48 >|| 
    49 hit: 5op(const, constant item) 
    50 hit: 5op(const, constant item) 
    51 hit: 62op(add, addition (+)) 
    52 hit: 5op(const, constant item) 
    53 hit: 5op(const, constant item) 
    54 hit: 62op(add, addition (+)) 
    55 ... 
    56 ||< 
     98Q4M の欠点。 
    5799---- 
    58 snip snip snip 
    59 ---- 
    60 <span style="font-size: 10px;">つづき</span> 
    61 >|| 
    62 hit: 5op(const, constant item) 
    63 hit: 6op(gvsv, scalar variable) 
    64 hit: 15op(rv2sv, scalar dereference) 
    65 hit: 15op(rv2sv, scalar dereference) 
    66 hit: 68op(left_shift, left bitshift (<<)) 
    67 hit: 178op(leave, block exit) 
    68 Your perl is : 5.8.8 
    69 Your score is : 1000op 
    70 ||< 
    71 ---- 
    72 29B 
    73 ---- 
    74 *Other Asnwers 
    75 ---- 
    76 ``;``;1*1 
    77 17B 
    78 backtick++ 
    79 ---- 
    80 1>>-f1%1-f1.-f1 
    81 15B 
    82  
    83 253op(ftfile, -f) 
    84 ---- 
    85 do+1<<(1<<1) 
    86 12B 
    87  
    88 310op(dofile, do "file") 
    89 ---- 
    90 !!!!$a>=1 
    91 9B 
    92  
    93 96op(not, not) 
    94 ---- 
    95 1<<[]-[] 
    96 8B 
    97  
    98 143op(anonlist, anonymous list ([])) 
    99 21op(srefgen, single ref constructor) 
    100 ---- 
    101 1/!!!!1 
    102 7B 
    103 ---- 
    104 *2000op 
    105 ---- 
    106 {$a++}{[]} 
    107 10B 
    108  
    109 loop makes too much op code! 
    110 ---- 
    111 *3000op 
    112 ---- 
    113 {{{~!1};!!1};}!1 
    114 16B 
    115 ---- 
    116 *Let's try! 
    117 ---- 
    118 perl -MAcme::PerlVMGolf -e '0' 
     100インスコまんどいお >< 
    119101---- 
    120102That's all.