You are viewing william_os4y

Tue, Jul. 27th, 2010, 10:27 am
Release 0.6 of Fast Asynchronous Python Wsgi Server

This new Fapws3 release fixes several bugs and bring the new "timers" feature.
http://github.com/william-os4y/fapws3
http://pypi.python.org/pypi/fapws3/


As you can see in the sample, timers allow you to execute a recurrent tasks with a predefined frequency.
I'm using it in the sample to show you the performance impact it can has on a commit.
This is just a sample and I know that this will not fit every cases.

I'm currently working on a real "defer" where you can as Fapws3 to execute a tasks asynchronously from the rest of the application.
Current tests I'm doing are really promising, but wait and see ;-). Maybe for the next release.

I inform you that Fapws3 users' community is increasing and I frequently receive positive feedbacks, questions, ... .
Those questions are mainly coming from the lack of documentation regarding Fapws3.
Thus, I would request help from you for 2 main items.

People interested to provide some help have to contact me by email.


1. Documentation
------------------------------
To allow those people to better step-in Fapws3, I request help from you to improve the documentation of Fapws3.
This can be generic docs, howtos, trips, ...

To be pragmatic, send me your texts (html format) in text files, I'll add them on the website.
If the requests are too frequents, I will check to implement a wiki (but this is for later).


2. Tests script
------------------------
I have the idea to implement a script that will perform some tests and send results on our website (www.fapws.org). Every people interested could be execute the tests and share the results with us, on our website.

The idea is to have a system like some linux distributions are doing: collecting some specific informations and share them by sending it to a webserver.
I plan to send them via an http POST request.

Basically, I'm thinking about a script that will use the "ApacheBenchamrk" tool and will test some basic features of Fapws3: return a list object, return an iterable object and return a file (you have then in the famous hello_world.py sample).
Thus the script will return data like " Req/sec, Concurrency Level, Time taken for tests, Complete requests, Failed requests:, Write errors:, Requests per second, Transfer rate"
More over the script must collect some critical info about the context of the machine: cpu model, libev_flag, kernel (uname -a), fapws3 version, libev version, python version.

This will gives an idea of the performance on different systems.
This will show on which system Fapws3 can runs.
...


To provide some ideas, I'm thinking about something like:

LOG="bench_`date +%Y%m%d%H%M%S`.log"
nice -n 20 ab -n100000 -c10 http://127.0.0.1:8080/hello >> $LOG
nice -n 20 ab -n50000 -c10 http://127.0.0.1:8080/long >> $LOG
nice -n 20 ab -n50000 -c10 http://127.0.0.1:8080/iteration >> $LOG
#Parse $LOG
#Collect machine data
#send them to www.fapws.org


The server script will be something like:

# -*- coding: utf-8 -*-

import fapws._evwsgi as evwsgi
from fapws import base
from fapws.contrib import views
import os
import platform


def hello(environ, start_response):
    global switch
    start_response('200 OK', [('Content-Type','text/html')])
    switch=1
    evwsgi.trigger_idle()
    return ["hello world!!"]

staticlong=views.Staticfile("long.txt") #this is the long test residing in hello_world's sample

def iteration(environ, start_response):
    global switch
    start_response('200 OK', [('Content-Type','text/html')])
    yield "hello"
    yield " "
    yield "world!!"

def getenv(environ, start_response):
    start_response('200 OK', [('Content-Type','text/html')])
    env={}
    env['LIBEV_FLAGS']=os.environ.get('LIBEV_FLAGS','') #best would be to catch the default too
    env['libev']=evwsgi.libev_version()
    env['python']=platform.python_version()
    env['uname']=platform.uname()
    #other parameters still to implement
    return [str(env)]
   

def start():
    evwsgi.start("0.0.0.0", "8080")
    evwsgi.set_base_module(base)
   
    evwsgi.wsgi_cb(("/hello", hello))
    evwsgi.wsgi_cb(("/iterhello", iteration))
    evwsgi.wsgi_cb(("/long", staticlong))
    evwsgi.wsgi_cb(("/getenv", getenv))

    evwsgi.set_debug(0)   
    evwsgi.run()
   

if __name__=="__main__":
    start()


For sure, on the server side, a Fapws3 script must be written to collect all the feedbacks, store then in a small DB (preferable sqlite) and also present them into nice tables, and, maybe, some charts.

W.