24
DeNA loves Perl Tokiharu Noto (DeNA Co., Ltd.) 1

Dena Loves Perl

  • Upload
    notolab

  • View
    4.340

  • Download
    0

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Dena Loves Perl

DeNA loves PerlTokiharu Noto

(DeNA Co., Ltd.)

1

Page 2: Dena Loves Perl

agenda

• How much / why does DeNA love Perl?

• outline of Perl usage in DeNA

• YAPC-driven Open Source from DeNA

• mobamail: mail delivery for mobile phone

• Mobage-town Open Platform

• ambivalent love for Perl

2

Page 3: Dena Loves Perl

DeNA services powered by Perl

2006

2007 2008

2004

2006

2008

2004

一部機能2009

3

Page 4: Dena Loves Perl

How many DeNA engineers love Perl?

• about 100 engineers

• > 50 engineers in mbga.jp team

• YAPC::Asia Tokyo 2009 speakers

• Hideo Kimura (modern Catalyst)

• Toru Yamaguchi (Perl DB test using MySQL::Sandbox)

• Tadashi Matsuda (MobaSiF::Template)

4

Page 5: Dena Loves Perl

Why does DeNA love Perl?

• bidders: Java + Oracle

• In 2003, Kawasaki has started developing mbok.jp with Perl

• In 2006, ex-bidders engineers joined to Moba* services

• dev/edit/exec speed++, readability++, productivity++ (also for biz people)

• The whole DeNA have loved Perl since

5

Page 6: Dena Loves Perl

DeNA scalable web architecture

LoadBalancer

LoadBalancer

httpd+fcgiservers

M

S S S ...

M

S S S ... MySQL+Senna

MySQLw/replication

...

... partitioning

...

memcached

mbga > 90

mbga > 1300servers

LVSDNS RR

6

Page 7: Dena Loves Perl

MobaSiFDeNA original WAF

• Open Source since YAPC::Asia Tokyo 2008

• pros

• common modules for mobile web

• simple, light-weight, fast

• stable

• cons

• no PSGI/Plack ;-)

• $_::F, $rhData

• no test...

• too free for a large team...

Apache

mod_fastcgi

MobaSiF

pictgraph converter

dispatcher

handset ditector

template engine

web applications

7

Page 8: Dena Loves Perl

YAPC-drivenOpen Source

• 2008

• MobaSiF

• 2009

• MobaSiF::Template (Matsuda)

• mobamail - fast mail delivery daemon for mobile phones

8

Page 9: Dena Loves Perl

mail deliveryfor mobile phones

• Mobile phone carriers deny SMTP connection at their own discretion (裁量).

• “spam?”

• especially when senders try to send mails with high speed...

• conflict with our wish “more speeeeedy!”

9

Page 10: Dena Loves Perl

mail delivery for mobile phones

• 1.09 億 (109 million) users / 3 carrier ≒ ISP

• MX (cf. dig -t MX <domainname>)

• docomo.ne.jp: 4 IP addresses

• ezweb.ne.jp: 1 IP address

• softbank.ne.jp: 1 IP address

10

Page 11: Dena Loves Perl

!!"#$!%&'(&)!

!!!!

"#*!%&'(&)!

+,PC -./0,"#$%&'(&)123456-78"#*%&'(&)9:1;<=>?@A4BC1DEFG!

!!

"#$!%&'(&)!

"#*!%&'(&)!

H,IJ-./0,"#$%&'(&)-31KLM6-78"#*%&'(&)9:1;<=>?@A4BC1D4NG!

!!

OPQR,A! OPQR,B OPQR,C

mail deliveryfor mobile phones

11

Page 12: Dena Loves Perl

before mobamail

• At first (2004-), we used qmail, postfix

• slow injection

• main: sendmail command

• SMTP/QMTP...

• We have to make our own original server...

12

Page 13: Dena Loves Perl

mobamail

• implemented in pure Perl

• ≠ MTA (no SMTP receive, relay)

• injection = insert into a table in MySQL

• high speed table2mail to mobile phones

• max speed (depend on carrier-side config)

• docomo+au: 500,000 mails/h

softbank: 20,000 mails/h

13

Page 14: Dena Loves Perl

mobamail strategy• provide tuning params

for best effort under the carriers permission:

• num of connection

• connect() interval

• mail per connection

• mail interval (in one connection)

• interval after denied

• connection closed, timeout, ...

• timeout

• connect()

• wait for response

• unused connection

• error count

=> retry_interval

14

Page 15: Dena Loves Perl

mobamail architecture

‘dist’ daemon

MySQL

‘docomo’

‘au’

‘softbank’

‘default’‘send’ daemon

processes

MX

MXdocomo...

MX

MXau...

MX

MXsoftbank...

MX

MXother ISP...

IO::Select

one server

SMTP

15

Page 16: Dena Loves Perl

current operationMX

MXdocomo...

MX

MXau...

MX

MXsoftbank...

MX

MXother ISP...

SIELLA ENGINE

mobamail

mobamail

better performance

without tuning16

Page 17: Dena Loves Perl

mobamailwill be available at...

• http://sourceforge.jp/projects/moba/

• http://d.hatena.ne.jp/tokiharu/ (w/RSS)

17

Page 18: Dena Loves Perl

Mobage-town Open Platform18

Page 19: Dena Loves Perl

DeNA & Perl, again

19

Page 20: Dena Loves Perl

DeNA dev policy

• すべてのエンジニアがビジネスの成功にコミットする

• 設立から数年赤字で苦労した...

• 「たくさんの人に使ってもらいたい」というエンジニアの原点

• お金で解決せず技術で =>「安く・速く」

• ビジネス/数字を意識しているから企画にも関われる

• ただ、きれいな技術が二の次になるという面も否めない...

20

Page 21: Dena Loves Perl

ambivalent love• 100 人近く Perl エンジニアがいるのに CPAN コミットがない。なぜ?

• 他社特許侵害のリスク (担保する仕組みは欲しい)

• やりたい人がいたら推奨しようとしているが...

• DeNA の Perl での開発方針

• 「一筆書き文化」: 再利用性や汎用性の設計に時間をかけるくらいなら、そういったことは考えずに書く方が速い (おおむね)

• サービス単位の独自性・機動性重視 = モジュールの共有なし

→ 割り切りの思想、逆転の思想、これで勝ってきた面も。

• ただ CPAN の文化 (組織をまたがったコードの共有) と相容れない!

21

Page 22: Dena Loves Perl

DeNA gonna love CPAN

• 正直、あんまり自覚がなかった• Some pilot projects depend on a lot of CPAN

modules (and Catalyst)

• 今までの強みを活かした折衷案を• dev policy for the large team

• more test code

• MobaSiF next generation

22

Page 23: Dena Loves Perl

DeNA loves Perl!

• a Perl community cosists of 100 engineers

• Let’s write code together!

• as DeNA software engineer / architect

• as developer of Mobage-town applications

• as CPAN author

23

Page 24: Dena Loves Perl

DeNA loves Perl!

24