Hi Guys, Do you have any hints how to speed up live page loading time? How to add compression or caching to xhtml and javascript files? Peter
This is a wide-ranging topic, with possibilities on many levels. As far as twisted-web itself, my experience is that it can be very rapid in response. Your solution may lie elsewhere, but can you be more specific as to your situation? Thanks, George On Mon, 2009-02-09 at 13:49 -0800, Piotr Jackowski wrote:
Hi Guys,
Do you have any hints how to speed up live page loading time? How to add compression or caching to xhtml and javascript files?
Peter _______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
-- George Pauly Ring Development www.ringdevelopment.com
Hi George Yes I know this is a wide-range topic. I have just started developing with Nevow and I don't have any major problem yet. I'm on planing stage so I just wanted to know what options I have. First maybe I would like to know how to compress response, including javascript files from Nevow/Athena framework. After every request to LivePage there are 3-4 additional requests for Nevow js and I want add my js files too. I was thinking about using dojotoolkit.org, so I can end up with many js static files. Peter On Mon, Feb 9, 2009 at 2:16 PM, George Pauly <george@ringdevelopment.com>wrote:
This is a wide-ranging topic, with possibilities on many levels.
As far as twisted-web itself, my experience is that it can be very rapid in response.
Your solution may lie elsewhere, but can you be more specific as to your situation?
Thanks,
George
On Mon, 2009-02-09 at 13:49 -0800, Piotr Jackowski wrote:
Hi Guys,
Do you have any hints how to speed up live page loading time? How to add compression or caching to xhtml and javascript files?
Peter _______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
-- George Pauly Ring Development www.ringdevelopment.com
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
On Mon, 9 Feb 2009 17:26:54 -0800, Piotr Jackowski <jackowski.piotr@gmail.com> wrote:
Hi George
Yes I know this is a wide-range topic. I have just started developing with Nevow and I don't have any major problem yet. I'm on planing stage so I just wanted to know what options I have. First maybe I would like to know how to compress response, including javascript files from Nevow/Athena framework. After every request to LivePage there are 3-4 additional requests for Nevow js and I want add my js files too. I was thinking about using dojotoolkit.org, so I can end up with many js static files.
Try setting jsModuleRoot to something cacheable if you don't want every page load to require the JavaScript module sources to be downloaded again. Jean-Paul
Hello All, LiveElement is fantastic, but I'm too stupid to find out, how to put temporary page under sessiop URL... This work for js modules at start like: http://localhost:8080/user/<HASH clientID>/jsmodule/athena_test I'd like to add temporary during run time something like: http://localhost:8080/user/<HASH clientID>/your_data page or staticFile, which should exists only few minutes. How can I add a child to the livepage session path? Best regards, Paul
On 21 Apr, 08:57 pm, maillists@ivsn.com wrote:
Hello All,
LiveElement is fantastic, but I'm too stupid to find out, how to put temporary page under sessiop URL... This work for js modules at start like: http://localhost:8080/user/<HASH clientID>/jsmodule/athena_test
I'd like to add temporary during run time something like: http://localhost:8080/user/<HASH clientID>/your_data page or staticFile, which should exists only few minutes.
How can I add a child to the livepage session path?
The magical hash URL you're referring to is just an alias for your page instance. So all you need to do is, in your LiveElement: self.page.putChild("your_data", YourDataResource()) That YourDataResource() object (and its attendant URL) will then live as long as your LivePage connection does. This is an interesting use-case, and it should work fine - but be aware that you're relying on a pretty weird little corner of implementation details here. It certainly never occurred to *me* that somebody would want to do this :). Particularly, there's no public API for generating this URL; you'll have to rely on the fact that url.here.child(self.clientID) keeps working.
glyph@divmod.com wrote:
On 21 Apr, 08:57 pm, maillists@ivsn.com wrote:
Hello All,
LiveElement is fantastic, but I'm too stupid to find out, how to put temporary page under sessiop URL... This work for js modules at start like: http://localhost:8080/user/<HASH clientID>/jsmodule/athena_test
I'd like to add temporary during run time something like: http://localhost:8080/user/<HASH clientID>/your_data page or staticFile, which should exists only few minutes.
How can I add a child to the livepage session path?
The magical hash URL you're referring to is just an alias for your page instance. So all you need to do is, in your LiveElement:
self.page.putChild("your_data", YourDataResource())
That YourDataResource() object (and its attendant URL) will then live as long as your LivePage connection does.
This is an interesting use-case, and it should work fine - but be aware that you're relying on a pretty weird little corner of implementation details here. It certainly never occurred to *me* that somebody would want to do this :).
Particularly, there's no public API for generating this URL; you'll have to rely on the fact that url.here.child(self.clientID) keeps working.
Thank you for that fast answer, I've tried before and now again, but this work only when one instance is running. If you try on i.e. chatterbox, after 2nd user join it is no more reliable, few times it works, but mostly not. I solved the problem by overriding locateChild in the top site instance of WidgetPluginRoot by checking segments[0] against all instances of elementFactory comparing their clientID and on match passing the request to own method added to LiveElement derived class. It is complicated, but seems to work... If there is an easier solution, I'll be happy. Caveat is, that instances of gone clients are keeping in memory. Is there a way to find out, that a client is gone (closed browser or switched to other site)? Thanks & regards, Paul
Paul Reznicek wrote:
glyph@divmod.com wrote:
On 21 Apr, 08:57 pm, maillists@ivsn.com wrote:
Hello All,
LiveElement is fantastic, but I'm too stupid to find out, how to put temporary page under sessiop URL... This work for js modules at start like: http://localhost:8080/user/<HASH clientID>/jsmodule/athena_test
I'd like to add temporary during run time something like: http://localhost:8080/user/<HASH clientID>/your_data page or staticFile, which should exists only few minutes. Caveat is, that instances of gone clients are keeping in memory. Is there a way to find out, that a client is gone (closed browser or switched to other site)? Welcome to the land of garbage collecting languages... What was the losing memory of the C++ ages is now the not releasing memory because of noncollectable garbage and server processes eating all the memory the machine has. I had to learn it the hard way but NEVER ever store a reference to something like sessions, mind or the the hierarchy of your LiveElements unless you're prepared to handle the breakup of the reference at cleanup time. Also keep in mind that the object hierarchy of client and server must be in sync or you're risking that the detach functionality does not work as advertised. Please see the detach/detached functionality in athena.py
class thePage(athena.LivePage): def beforeRender(self, ctx): : d = self.notifyOnDisconnect() d.addErrback(self.disconn) def disconn(self, reason): """ we will be called back when the client disconnects, just iterate over all children and call a disconnected func if available """ for child in self.liveFragmentChildren: if hasattr(child, 'disconnected'): child.disconnected(reason); Werner
Werner Thie wrote:
Paul Reznicek wrote:
glyph@divmod.com wrote:
On 21 Apr, 08:57 pm, maillists@ivsn.com wrote:
Hello All,
LiveElement is fantastic, but I'm too stupid to find out, how to put temporary page under sessiop URL... This work for js modules at start like: http://localhost:8080/user/<HASH clientID>/jsmodule/athena_test
I'd like to add temporary during run time something like: http://localhost:8080/user/<HASH clientID>/your_data page or staticFile, which should exists only few minutes. Caveat is, that instances of gone clients are keeping in memory. Is there a way to find out, that a client is gone (closed browser or switched to other site)? Welcome to the land of garbage collecting languages... What was the losing memory of the C++ ages is now the not releasing memory because of noncollectable garbage and server processes eating all the memory the machine has. I had to learn it the hard way but NEVER ever store a reference to something like sessions, mind or the the hierarchy of your LiveElements unless you're prepared to handle the breakup of the reference at cleanup time. Also keep in mind that the object hierarchy of client and server must be in sync or you're risking that the detach functionality does not work as advertised. Please see the detach/detached functionality in athena.py
class thePage(athena.LivePage):
def beforeRender(self, ctx): : d = self.notifyOnDisconnect() d.addErrback(self.disconn)
def disconn(self, reason): """ we will be called back when the client disconnects, just iterate over all children and call a disconnected func if available """ for child in self.liveFragmentChildren: if hasattr(child, 'disconnected'): child.disconnected(reason);
Werner
Great! Exactly what I needed to remove cleanly user with loosed connection. Together with Glyph's "_self.page.putChild('your_data', YourDataResource())_" all my problems are solved. BTW: How to use *detach* and *detached* in LiveElement? I didn't find out... Many thanks, Paul
Werner Thie pisze:
Please see the detach/detached functionality in athena.py
Saved that code snipped to the wiki here, thanks! http://divmod.org/trac/wiki/DivmodNevow/Athena/NotifyOnDisconnect -- m
CORRECTED PREVIOUS ANSWER glyph@divmod.com wrote:
On 21 Apr, 08:57 pm, maillists@ivsn.com wrote:
Hello All,
LiveElement is fantastic, but I'm too stupid to find out, how to put temporary page under sessiop URL... This work for js modules at start like: http://localhost:8080/user/<HASH clientID>/jsmodule/athena_test
I'd like to add temporary during run time something like: http://localhost:8080/user/<HASH clientID>/your_data page or staticFile, which should exists only few minutes.
How can I add a child to the livepage session path?
The magical hash URL you're referring to is just an alias for your page instance. So all you need to do is, in your LiveElement:
self.page.putChild("your_data", YourDataResource())
That YourDataResource() object (and its attendant URL) will then live as long as your LivePage connection does.
This is an interesting use-case, and it should work fine - but be aware that you're relying on a pretty weird little corner of implementation details here. It certainly never occurred to *me* that somebody would want to do this :).
Particularly, there's no public API for generating this URL; you'll have to rely on the fact that url.here.child(self.clientID) keeps working.
Sorry for confusing - your solution WORK FINE, even better than my, I used wrong testing method. Open question is, how to find out, that client is gone. To stay with chatterbox example: ChatRoom().chatters is a list of registered clients How can I check, who of them is still connected and who is invalid, so I can delete them from the list? Thanks again, Paul
Peter, I have no experience with Nevow/Athena, and you have Jean-Paul Calderone's advice. Since you are in the planning stage, I'll offer a technologically successful example of the use of a Dojo client and a Twisted server: http://simplemax.net/func.html The client consists of an HTML page that uses Dojo for several purposes. For server communication it uses Dojo's implementation of JSON/Ajax. The server uses twisted web's web.http.HTTPFactory . Even though the twisted server is hosted on a 2006-vintage 32-bit single processor machine on a residential network, the rate limiting factor (in North America) is rendering of the client output, which is throttled with the 'more output' control on the func.html page. I haven't used Javascript compression. When appropriate I design with an application pattern as in the func.html example above. This serves the end of cacheing, often on the screen of the client, reducing the need for compression. So I am a bad reference, but here are two alternatives: http://www.crockford.com/javascript/jsmin.html http://shrinksafe.dojotoolkit.org/ Also, I would point out that using the edge network cache of Dojo is essential to fast page loading. I use <SCRIPT TYPE="text/javascript" SRC="http://ajax.googleapis.com/ajax/libs/dojo/1.2/dojo/dojo.xd.js"> </SCRIPT> and similar links to the Dojo CSS. I'm not sure how well this works outside of North America, however. There is also an AOL network cache of Dojo. Regards, George On Mon, 2009-02-09 at 17:26 -0800, Piotr Jackowski wrote:
Hi George
Yes I know this is a wide-range topic. I have just started developing with Nevow and I don't have any major problem yet. I'm on planing stage so I just wanted to know what options I have. First maybe I would like to know how to compress response, including javascript files from Nevow/Athena framework. After every request to LivePage there are 3-4 additional requests for Nevow js and I want add my js files too. I was thinking about using dojotoolkit.org, so I can end up with many js static files.
Peter
On Mon, Feb 9, 2009 at 2:16 PM, George Pauly <george@ringdevelopment.com> wrote: This is a wide-ranging topic, with possibilities on many levels.
As far as twisted-web itself, my experience is that it can be very rapid in response.
Your solution may lie elsewhere, but can you be more specific as to your situation?
Thanks,
George
On Mon, 2009-02-09 at 13:49 -0800, Piotr Jackowski wrote: > > Hi Guys, > > Do you have any hints how to speed up live page loading time? > How to add compression or caching to xhtml and javascript files? > > > Peter
> _______________________________________________ > Twisted-web mailing list > Twisted-web@twistedmatrix.com > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web -- George Pauly Ring Development www.ringdevelopment.com
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
-- George Pauly Ring Development www.ringdevelopment.com
participants (7)
-
George Pauly
-
glyph@divmod.com
-
Jean-Paul Calderone
-
Michał Pasternak
-
Paul Reznicek
-
Piotr Jackowski
-
Werner Thie