web2py win binary: don't know if its wanted

122 views
Skip to first unread message

Niphlod

unread,
Oct 7, 2013, 7:50:10 PM10/7/13
to web2py-d...@googlegroups.com
Hi All,
    in the restricted env I have to live at work (corporate windows-based, can't install python, can't install apache, don't reaaaally want to fiddle with IIS), I'm taking much more care of the windows binary than ever ^_^

Also, I bashed Massimo's a few times saying that the binary he rebuilds lead to an unusual smaller library.zip than the one obtained by running py2exe.

After a few rounds, I discovered that by default py2exe packages exactly two copies of gluon (and gluon/contrib) as duplicate files into library.zip .
It may be due to circular imports (and/or from gluon.something import something vs import something).

To sum up, tomorrow I'll test a build obtained by a slightly modified setup_exe.py that eliminates the issue de-compressing and re-compressing library.zip, and I'll then send a PR if it all works out.
It's clearly an hack, and to be fair, py2exe is slightly unpredictable (and seems a bit "old").
That's reason one to look for alternatives.

Reason 2: I tried unsuccessfully to build web2py including something more "speedy" than rocket to be served in.

After a little bit of thought, seemed that on windows the best option was gevent (has even SSL support!).

But....gevent + py2exe is like asking for disaster.

So, I started looking at bbfreeze. Yes, it's a little bit undocumented, but the source code is quite understandable .
One or two hacks later, web2py was working fine with no need for workarounds, packed with bbfreeze.
Bonus points, I could successfully package gevent in it, so I can serve web2py apps with gevent.pywsgi! (roughly, 3x performance speedup, and a solid 15x just serving static files). In addition to the "default" two binaries, I created a third one stripping out anyserver to serve only on gevent (web2py_gevent.exe)

Now, 3 questions:
- is anyone contrary in shifting to bbfreeze for building the windows binary (less hackish, not 5 years old, etc) ? The current Makefile doesn't need to change, bbfreeze ships library.zip too.
- does anyone like the idea of a 3x performance speedup on windows ?
- is this worth it ?

Massimo DiPierro

unread,
Oct 7, 2013, 8:19:51 PM10/7/13
to web2py-d...@googlegroups.com
I do not oppose as long as you commit to maintain this and we do not lose ssl support.

--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Niphlod

unread,
Oct 8, 2013, 2:43:00 AM10/8/13
to web2py-d...@googlegroups.com
It's just the usual web2py.exe plus web2py_gevent.exe, packaged with bbfreeze instead of py2exe (web2py.exe still uses rocket, launches scheduler and so on, while web2py_gevent.exe just launches the webserver).
Leaving out gevent, it's just the same archive, packaged with one "more modern" tool instead of the usual one.

I won't commit to maintain it (just formally, I don't want to be a SPOF nor the only developer with the knowhow in building binaries): I'm going to put on web2pyslices.com the complete steps from a clean Windows installation (what python to install, what libraries, how to download the source, what to launch) so the entire community will be able to.

Massimo Di Pierro

unread,
Oct 8, 2013, 11:38:59 AM10/8/13
to web2py-d...@googlegroups.com
This is great! I may include it in the current build process as long as I can update it without a windows machine.

Tim Richardson

unread,
Oct 9, 2013, 6:48:13 AM10/9/13
to web2py-d...@googlegroups.com
I use rocket on a couple of intranet deployments on a windows server because IIS is not in use, I don't want to get involved with it and I don't really want to put a big webserver on this small business server. But intranet apps have a habit of growing, particularly when it is so easy to add functionality. So something which is comparably hassle free but much faster is great. SSL is a must. I'd be really grateful. 

But where does such a performance boost come from? 

Niphlod

unread,
Oct 9, 2013, 2:19:09 PM10/9/13
to web2py-d...@googlegroups.com


On Wednesday, October 9, 2013 12:48:13 PM UTC+2, Tim Richardson wrote:
I use rocket on a couple of intranet deployments on a windows server because IIS is not in use, I don't want to get involved with it and I don't really want to put a big webserver on this small business server. But intranet apps have a habit of growing, particularly when it is so easy to add functionality. So something which is comparably hassle free but much faster is great. SSL is a must. I'd be really grateful. 

But where does such a performance boost come from? 
I assume from the fact that threading in Windows is even slower than "usual" linux-based (c)python. On the same hardware spec, python 2.7.3 on ubuntu 12.10 vs python 2.7.3 on Win 7 shows that Windows is slower by a solid 60%. Gevent on Windows seems to use a good implementation that is still slower than gevent on linux, but is a huge gain compared to the "normal" threading on win.

Massimo DiPierro

unread,
Oct 9, 2013, 2:28:58 PM10/9/13
to web2py-d...@googlegroups.com
Where is it? I cannot find it.

On Oct 8, 2013, at 1:43 AM, Niphlod wrote:

Niphlod

unread,
Oct 9, 2013, 2:55:21 PM10/9/13
to web2py-d...@googlegroups.com
you can't because I'm still testing gevent.
However, I made some docs on how to build the binary with bbfreeze and in the weekend I'll post the results of the "experiment".

Niphlod

unread,
Oct 12, 2013, 2:38:22 PM10/12/13
to web2py-d...@googlegroups.com
ok, all tests went fine both with builds with bbfreeze AND packing bbfreeze + a gevented server.
In agreement with Massimo, I'm starting a little "contest" both to test the new binaries and to involve the community.
Stay tuned for the winner :D

Niphlod

unread,
Oct 20, 2013, 3:33:10 PM10/20/13
to web2py-d...@googlegroups.com
As said here https://groups.google.com/d/msg/web2py/DZ0jANyOSSw/rIsR6r8xGGkJ , @Brian M won the contest.

Following releases of web2py will ship the bbfreeze-packed version of web2py.

I have to figure out an additional detail before sending the PR: as for the previous "plan" I'd like web2py binaries to include a "faster" webserver (on Windows rocket is not **that** performant).
I coded a little script to have a gevented webserver fully-featured (address, port AND SSL support) named web2py_on_gevent.py. That one is going to be built along with the usual web2py.exe and web2py_no_console.exe and will exclusively run the webserver (no GUI, no scheduler, etc etc etc).

And here's the hard part.....where should I put that ?
ideas I had:
in extras/build_web2py  --> needed to build the windows binary with bbfreeze, but it's not windows-specific....
in handlers --> it's a handler in the sense it's an adapter to run on gevent, but it's not a handler like every other handler on that folder
....

?

 

Michele Comitini

unread,
Oct 20, 2013, 4:02:23 PM10/20/13
to web2py-developers
I think any other OS would benefit from gevent based server even for testing.  I am for handlers.

Since a while ago, for my tests, I dropped rocket because I need to handle more than a request at a time. I use gunicorn like this: 
gunicorn -w 10 -t 1000 gluon.main:wsgibase
The difference is huge in favor of gunicorn.

mic


2013/10/20 Niphlod <nip...@gmail.com>

Massimo DiPierro

unread,
Oct 20, 2013, 6:51:22 PM10/20/13
to web2py-d...@googlegroups.com
What's Brian full name?

Niphlod

unread,
Oct 21, 2013, 6:46:37 AM10/21/13
to web2py-d...@googlegroups.com
Brian Meredyk

Niphlod

unread,
Oct 21, 2013, 12:56:21 PM10/21/13
to web2py-d...@googlegroups.com
/handlers/web2py_on_gevent.py then ? Everybody on board ?


Niphlod

unread,
Oct 22, 2013, 3:30:06 AM10/22/13
to web2py-d...@googlegroups.com
I sent the PR. Someone willing to copy the slice to the book ?

Tim Richardson

unread,
Oct 22, 2013, 4:46:18 AM10/22/13
to web2py-d...@googlegroups.com
I will since I want to know how to do it :) Two birds...


--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py-developers/YN46WqVweVI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py-develop...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--
Tim Richardson

Massimo DiPierro

unread,
Oct 22, 2013, 8:37:26 AM10/22/13
to web2py-d...@googlegroups.com
Thank you Tim.

You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages