ISUCON
Python
  2011.09.06   #4 LT
•   HN:

    •                    id:memememomo

    •   Twitter (@memememomo)

    •   github (memememomo)

•   ISUCON
    •
•
    •   perl   PHP
ISUCON
• ruby
 •   Sinatra

• perl
 •   Kossy

• node.js
 •   express
ISUCON
• ruby         use Kossy;
 •   Sinatra
               get '/article/:articleid' => sub {
• perl            my ( $self, $c ) = @_;
 •   Kossy        $c->render('article.tx', { article =>
• node.js      $article, comments => $comments });
               };
 •   express
ISUCON
• ruby         use Kossy;
 •   Sinatra
               get '/article/:articleid' => sub {
• perl            my ( $self, $c ) = @_;
 •   Kossy        $c->render('article.tx', { article =>
• node.js      $article, comments => $comments });
               };
 •   express
ISUCON
• ruby         use Kossy;
 •   Sinatra
               get '/article/:articleid' => sub {
• perl            my ( $self, $c ) = @_;
 •   Kossy        $c->render('article.tx', { article =>
• node.js      $article, comments => $comments });
               };
 •   express
ISUCON
• ruby         use Kossy;
 •   Sinatra
               get '/article/:articleid' => sub {
• perl            my ( $self, $c ) = @_;
 •   Kossy        $c->render('article.tx', { article =>
• node.js      $article, comments => $comments });
               };
 •   express
ISUCON
• ruby            use Kossy;
 •   Sinatra
                  get '/article/:articleid' => sub {
• perl               my ( $self, $c ) = @_;
 •   Kossy           $c->render('article.tx', { article =>
• node.js         $article, comments => $comments });
                  };
 •   express



               Python          Flask
Flask
 from flask import Flask

 app = Flask(__name__)


 @app.route('/')
 def index():
    .....
     return render_template('index.html', articles=articles,
 sidebaritems=g.sidebaritems)

 @app.route('/post', methods=['GET'])
 def get_post():
     return render_template('post.html')

 @app.route('/post', methods=['POST'])
 def post_post():
     .....
     return redirect(url_for('index'))

 if __name__ == '__main__':
     app.run(host='0.0.0.0')



https://github.com/memememomo/python-isucon
Flask
 from flask import Flask

 app = Flask(__name__)


 @app.route('/')
 def index():
    .....
     return render_template('index.html', articles=articles,
 sidebaritems=g.sidebaritems)

 @app.route('/post', methods=['GET'])
 def get_post():
     return render_template('post.html')

 @app.route('/post', methods=['POST'])
 def post_post():
     .....
     return redirect(url_for('index'))

 if __name__ == '__main__':
     app.run(host='0.0.0.0')



https://github.com/memememomo/python-isucon
Flask
 from flask import Flask

 app = Flask(__name__)


 @app.route('/')
 def index():
    .....
     return render_template('index.html', articles=articles,
 sidebaritems=g.sidebaritems)

 @app.route('/post', methods=['GET'])
 def get_post():
     return render_template('post.html')

 @app.route('/post', methods=['POST'])
 def post_post():
     .....
     return redirect(url_for('index'))

 if __name__ == '__main__':
     app.run(host='0.0.0.0')



https://github.com/memememomo/python-isucon
Flask
 from flask import Flask

 app = Flask(__name__)


 @app.route('/')
 def index():
    .....
     return render_template('index.html', articles=articles,
 sidebaritems=g.sidebaritems)

 @app.route('/post', methods=['GET'])
 def get_post():
     return render_template('post.html')

 @app.route('/post', methods=['POST'])
 def post_post():
     .....
     return redirect(url_for('index'))

 if __name__ == '__main__':
     app.run(host='0.0.0.0')



https://github.com/memememomo/python-isucon
Flask
 from flask import Flask

 app = Flask(__name__)


 @app.route('/')
 def index():
    .....
     return render_template('index.html', articles=articles,
 sidebaritems=g.sidebaritems)

 @app.route('/post', methods=['GET'])
 def get_post():
     return render_template('post.html')

 @app.route('/post', methods=['POST'])
 def post_post():
     .....
     return redirect(url_for('index'))

 if __name__ == '__main__':
     app.run(host='0.0.0.0')



https://github.com/memememomo/python-isucon
Flask
 from flask import Flask

 app = Flask(__name__)


 @app.route('/')
 def index():
    .....
     return render_template('index.html', articles=articles,
 sidebaritems=g.sidebaritems)

 @app.route('/post', methods=['GET'])
 def get_post():
     return render_template('post.html')

 @app.route('/post', methods=['POST'])
 def post_post():
     .....
     return redirect(url_for('index'))

 if __name__ == '__main__':
     app.run(host='0.0.0.0')



https://github.com/memememomo/python-isucon
•       App

•
•       http_load           2

•       App
    •    app1 (perl + starman)
    •    app2 (ruby + apache + passenger)
    •    app3 (node.js)
    •    app4 (python + apache + mod_wsgi)
•
    •   python isucon

    •

•
    •
ISUCONアプリを Pythonで書いてみた

ISUCONアプリを Pythonで書いてみた

  • 1.
  • 2.
    HN: • id:memememomo • Twitter (@memememomo) • github (memememomo) • ISUCON • • • perl PHP
  • 3.
    ISUCON • ruby • Sinatra • perl • Kossy • node.js • express
  • 4.
    ISUCON • ruby use Kossy; • Sinatra get '/article/:articleid' => sub { • perl my ( $self, $c ) = @_; • Kossy $c->render('article.tx', { article => • node.js $article, comments => $comments }); }; • express
  • 5.
    ISUCON • ruby use Kossy; • Sinatra get '/article/:articleid' => sub { • perl my ( $self, $c ) = @_; • Kossy $c->render('article.tx', { article => • node.js $article, comments => $comments }); }; • express
  • 6.
    ISUCON • ruby use Kossy; • Sinatra get '/article/:articleid' => sub { • perl my ( $self, $c ) = @_; • Kossy $c->render('article.tx', { article => • node.js $article, comments => $comments }); }; • express
  • 7.
    ISUCON • ruby use Kossy; • Sinatra get '/article/:articleid' => sub { • perl my ( $self, $c ) = @_; • Kossy $c->render('article.tx', { article => • node.js $article, comments => $comments }); }; • express
  • 8.
    ISUCON • ruby use Kossy; • Sinatra get '/article/:articleid' => sub { • perl my ( $self, $c ) = @_; • Kossy $c->render('article.tx', { article => • node.js $article, comments => $comments }); }; • express Python Flask
  • 9.
    Flask from flaskimport Flask app = Flask(__name__) @app.route('/') def index(): .....     return render_template('index.html', articles=articles, sidebaritems=g.sidebaritems) @app.route('/post', methods=['GET']) def get_post():     return render_template('post.html') @app.route('/post', methods=['POST']) def post_post(): .....     return redirect(url_for('index')) if __name__ == '__main__':     app.run(host='0.0.0.0') https://github.com/memememomo/python-isucon
  • 10.
    Flask from flaskimport Flask app = Flask(__name__) @app.route('/') def index(): .....     return render_template('index.html', articles=articles, sidebaritems=g.sidebaritems) @app.route('/post', methods=['GET']) def get_post():     return render_template('post.html') @app.route('/post', methods=['POST']) def post_post(): .....     return redirect(url_for('index')) if __name__ == '__main__':     app.run(host='0.0.0.0') https://github.com/memememomo/python-isucon
  • 11.
    Flask from flaskimport Flask app = Flask(__name__) @app.route('/') def index(): .....     return render_template('index.html', articles=articles, sidebaritems=g.sidebaritems) @app.route('/post', methods=['GET']) def get_post():     return render_template('post.html') @app.route('/post', methods=['POST']) def post_post(): .....     return redirect(url_for('index')) if __name__ == '__main__':     app.run(host='0.0.0.0') https://github.com/memememomo/python-isucon
  • 12.
    Flask from flaskimport Flask app = Flask(__name__) @app.route('/') def index(): .....     return render_template('index.html', articles=articles, sidebaritems=g.sidebaritems) @app.route('/post', methods=['GET']) def get_post():     return render_template('post.html') @app.route('/post', methods=['POST']) def post_post(): .....     return redirect(url_for('index')) if __name__ == '__main__':     app.run(host='0.0.0.0') https://github.com/memememomo/python-isucon
  • 13.
    Flask from flaskimport Flask app = Flask(__name__) @app.route('/') def index(): .....     return render_template('index.html', articles=articles, sidebaritems=g.sidebaritems) @app.route('/post', methods=['GET']) def get_post():     return render_template('post.html') @app.route('/post', methods=['POST']) def post_post(): .....     return redirect(url_for('index')) if __name__ == '__main__':     app.run(host='0.0.0.0') https://github.com/memememomo/python-isucon
  • 14.
    Flask from flaskimport Flask app = Flask(__name__) @app.route('/') def index(): .....     return render_template('index.html', articles=articles, sidebaritems=g.sidebaritems) @app.route('/post', methods=['GET']) def get_post():     return render_template('post.html') @app.route('/post', methods=['POST']) def post_post(): .....     return redirect(url_for('index')) if __name__ == '__main__':     app.run(host='0.0.0.0') https://github.com/memememomo/python-isucon
  • 16.
    App • • http_load 2 • App • app1 (perl + starman) • app2 (ruby + apache + passenger) • app3 (node.js) • app4 (python + apache + mod_wsgi)
  • 18.
    • python isucon • • •