Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

Accessing skins objects

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


charlie at begeistert

Feb 9, 2009, 2:12 AM

Post #1 of 11 (1403 views)
Permalink
Accessing skins objects

Hi,

I've written a very simple view for concactenating resources such as
CSS or Javascript files to reduce the number of http browser requests:


from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.browser.utils import memoize, ViewBase

class Javascript(ViewBase):
"""Return all Javascript from the skin as a single string"""

folder_name = 'js'
content_type = 'application/x-javascript'

@memoize
def contents(self):
skin_tool = getToolByName(self.context, 'portal_skins')
layer = skin_tool.getDefaultSkin()
skin = skin_tool.getSkinByName(layer)
folder = getattr(skin, self.folder_name)
obs = [str(ob) for ob in folder.objectValues()
if ob.meta_type == "Filesystem File"]
return "\n".join(obs)

def __call__(self):
data = self.contents()
self.request.response.setHeader("Content-Type",
self.content_type)
self.request.response.setHeader("Content-Length", len(data))
self.request.response.write(data)

While this works fine, it seems to run considerably slower (about half
the speed) than a PythonScript that calls the relevant objects
explicitly via getattr(context, id). I'm a bit surprised at this but
suspect it may down to whether the file system is actually accessed or
whether a persistent object is being called. In my browser view it is
impossible to avoid reading in the file again as this happens the
__str__ method of the FSFile object.

In the hope of enlightenment.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


tseaver at palladion

Feb 9, 2009, 7:10 AM

Post #2 of 11 (1352 views)
Permalink
Re: Accessing skins objects [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Charlie Clark wrote:
> Hi,
>
> I've written a very simple view for concactenating resources such as
> CSS or Javascript files to reduce the number of http browser requests:
>
>
> from Products.CMFCore.utils import getToolByName
> from Products.CMFDefault.browser.utils import memoize, ViewBase
>
> class Javascript(ViewBase):
> """Return all Javascript from the skin as a single string"""
>
> folder_name = 'js'
> content_type = 'application/x-javascript'
>
> @memoize
> def contents(self):
> skin_tool = getToolByName(self.context, 'portal_skins')
> layer = skin_tool.getDefaultSkin()
> skin = skin_tool.getSkinByName(layer)
> folder = getattr(skin, self.folder_name)
> obs = [str(ob) for ob in folder.objectValues()
> if ob.meta_type == "Filesystem File"]
> return "\n".join(obs)
>
> def __call__(self):
> data = self.contents()
> self.request.response.setHeader("Content-Type",
> self.content_type)
> self.request.response.setHeader("Content-Length", len(data))
> self.request.response.write(data)
>
> While this works fine, it seems to run considerably slower (about half
> the speed) than a PythonScript that calls the relevant objects
> explicitly via getattr(context, id). I'm a bit surprised at this but
> suspect it may down to whether the file system is actually accessed or
> whether a persistent object is being called. In my browser view it is
> impossible to avoid reading in the file again as this happens the
> __str__ method of the FSFile object.
>
> In the hope of enlightenment.

Try profiling the two requests and see what looks different. The FSFile
object *never* stores the bits read from the filesystem, so the more
likely case is that your view is hitting some other bottleneck.

BTW, it might be faster to compute the *filenames* in the memo, and then
return an IFilestreamIterator which chunked the response by reading the
files one at a time. Running 'cat /path/to/fsidr/*.js' in an
os.system() call might be faster, too ;)


Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver [at] palladion
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJkEdT+gerLs4ltQ4RApmBAJ4teYF55sK0pKu6uarUXBelhg6dXwCfcT5P
GVaGJKF4i1KD+JJTWkm1qOA=
=nq9A
-----END PGP SIGNATURE-----

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


tseaver at palladion

Feb 9, 2009, 7:10 AM

Post #3 of 11 (1348 views)
Permalink
Re: Accessing skins objects [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Charlie Clark wrote:
> Hi,
>
> I've written a very simple view for concactenating resources such as
> CSS or Javascript files to reduce the number of http browser requests:
>
>
> from Products.CMFCore.utils import getToolByName
> from Products.CMFDefault.browser.utils import memoize, ViewBase
>
> class Javascript(ViewBase):
> """Return all Javascript from the skin as a single string"""
>
> folder_name = 'js'
> content_type = 'application/x-javascript'
>
> @memoize
> def contents(self):
> skin_tool = getToolByName(self.context, 'portal_skins')
> layer = skin_tool.getDefaultSkin()
> skin = skin_tool.getSkinByName(layer)
> folder = getattr(skin, self.folder_name)
> obs = [str(ob) for ob in folder.objectValues()
> if ob.meta_type == "Filesystem File"]
> return "\n".join(obs)
>
> def __call__(self):
> data = self.contents()
> self.request.response.setHeader("Content-Type",
> self.content_type)
> self.request.response.setHeader("Content-Length", len(data))
> self.request.response.write(data)
>
> While this works fine, it seems to run considerably slower (about half
> the speed) than a PythonScript that calls the relevant objects
> explicitly via getattr(context, id). I'm a bit surprised at this but
> suspect it may down to whether the file system is actually accessed or
> whether a persistent object is being called. In my browser view it is
> impossible to avoid reading in the file again as this happens the
> __str__ method of the FSFile object.
>
> In the hope of enlightenment.

Try profiling the two requests and see what looks different. The FSFile
object *never* stores the bits read from the filesystem, so the more
likely case is that your view is hitting some other bottleneck.

BTW, it might be faster to compute the *filenames* in the memo, and then
return an IFilestreamIterator which chunked the response by reading the
files one at a time. Running 'cat /path/to/fsidr/*.js' in an
os.system() call might be faster, too ;)


Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver [at] palladion
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJkEdT+gerLs4ltQ4RApmBAJ4teYF55sK0pKu6uarUXBelhg6dXwCfcT5P
GVaGJKF4i1KD+JJTWkm1qOA=
=nq9A
-----END PGP SIGNATURE-----

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Feb 9, 2009, 7:23 AM

Post #4 of 11 (1351 views)
Permalink
Re: Accessing skins objects [In reply to]

Am 09.02.2009 um 16:10 schrieb Tres Seaver:

> Try profiling the two requests and see what looks different.

I thought someone might say that... ;-)

As heavy upstream caching is likely to be used I hope it's not
necessary to optimise this too much. The main advantage is reducing
the number of individual requests made by the browser when it first
sees the site. But I should get more familiar with profiling.

Running locally wget gives rates of around about 50 MB/s with the view
and around 120 MB/s for a PythonScript.

> The FSFile
> object *never* stores the bits read from the filesystem, so the more
> likely case is that your view is hitting some other bottleneck.

oh, what FS things are affected by the debug-mode flag that forces
them to be reread?, ie. which objects don't reflect underlying file-
system changes?

> BTW, it might be faster to compute the *filenames* in the memo, and
> then
> return an IFilestreamIterator which chunked the response by reading
> the
> files one at a time. Running 'cat /path/to/fsidr/*.js' in an
> os.system() call might be faster, too ;)


I quite like the iterator idea. BTW. Can I admit at this stage that I
don't really understand what the memoize method does? 8-)

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


tseaver at palladion

Feb 9, 2009, 9:53 AM

Post #5 of 11 (1351 views)
Permalink
Re: Accessing skins objects [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Charlie Clark wrote:
> Am 09.02.2009 um 16:10 schrieb Tres Seaver:
>
>> Try profiling the two requests and see what looks different.
>
> I thought someone might say that... ;-)
>
> As heavy upstream caching is likely to be used I hope it's not
> necessary to optimise this too much. The main advantage is reducing
> the number of individual requests made by the browser when it first
> sees the site. But I should get more familiar with profiling.
>
> Running locally wget gives rates of around about 50 MB/s with the view
> and around 120 MB/s for a PythonScript.

This is talking directly to Zope (no Varnish / Squid in front?) Please
post the PythonScript, too.

>> The FSFile
>> object *never* stores the bits read from the filesystem, so the more
>> likely case is that your view is hitting some other bottleneck.
>
> oh, what FS things are affected by the debug-mode flag that forces
> them to be reread?, ie. which objects don't reflect underlying file-
> system changes?

Other FS objects may have cached information computed from the file
(e.g., the compiled template bytecode for an FSPageTemplate, or bytecode
for an FSPythonScript). But there is nothing which reads FSFile data
into memory and holds it. both its '__str__' and its 'index_html'
reread the file from dist. However, the object *may* be cached by a
RAMCache or an AcceleratedHTTPCache, if one is configured.

If Globals.DevelopmentMode is enabled, then the call to '_updateFromFS'
in both of those methods ('__str__', 'index_html') removes the object
from the cache on each request.


>> BTW, it might be faster to compute the *filenames* in the memo, and
>> then
>> return an IFilestreamIterator which chunked the response by reading
>> the
>> files one at a time. Running 'cat /path/to/fsidr/*.js' in an
>> os.system() call might be faster, too ;)
>
>
> I quite like the iterator idea.

> BTW. Can I admit at this stage that I
> don't really understand what the memoize method does? 8-)

It caches the result of the method call in the view's instance
dictionary. Be *sure* to use it only for views: using it on a content
objecct would be disastrous.


Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver [at] palladion
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJkG2n+gerLs4ltQ4RAm3eAJ0eCpjGwEDE3ovCGxolURMiNwbtnwCgwQ0R
tOugGBjiygq91cV9wJ5gmHQ=
=2qJn
-----END PGP SIGNATURE-----
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


tseaver at palladion

Feb 9, 2009, 9:53 AM

Post #6 of 11 (1351 views)
Permalink
Re: Accessing skins objects [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Charlie Clark wrote:
> Am 09.02.2009 um 16:10 schrieb Tres Seaver:
>
>> Try profiling the two requests and see what looks different.
>
> I thought someone might say that... ;-)
>
> As heavy upstream caching is likely to be used I hope it's not
> necessary to optimise this too much. The main advantage is reducing
> the number of individual requests made by the browser when it first
> sees the site. But I should get more familiar with profiling.
>
> Running locally wget gives rates of around about 50 MB/s with the view
> and around 120 MB/s for a PythonScript.

This is talking directly to Zope (no Varnish / Squid in front?) Please
post the PythonScript, too.

>> The FSFile
>> object *never* stores the bits read from the filesystem, so the more
>> likely case is that your view is hitting some other bottleneck.
>
> oh, what FS things are affected by the debug-mode flag that forces
> them to be reread?, ie. which objects don't reflect underlying file-
> system changes?

Other FS objects may have cached information computed from the file
(e.g., the compiled template bytecode for an FSPageTemplate, or bytecode
for an FSPythonScript). But there is nothing which reads FSFile data
into memory and holds it. both its '__str__' and its 'index_html'
reread the file from dist. However, the object *may* be cached by a
RAMCache or an AcceleratedHTTPCache, if one is configured.

If Globals.DevelopmentMode is enabled, then the call to '_updateFromFS'
in both of those methods ('__str__', 'index_html') removes the object
from the cache on each request.


>> BTW, it might be faster to compute the *filenames* in the memo, and
>> then
>> return an IFilestreamIterator which chunked the response by reading
>> the
>> files one at a time. Running 'cat /path/to/fsidr/*.js' in an
>> os.system() call might be faster, too ;)
>
>
> I quite like the iterator idea.

> BTW. Can I admit at this stage that I
> don't really understand what the memoize method does? 8-)

It caches the result of the method call in the view's instance
dictionary. Be *sure* to use it only for views: using it on a content
objecct would be disastrous.


Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver [at] palladion
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJkG2n+gerLs4ltQ4RAm3eAJ0eCpjGwEDE3ovCGxolURMiNwbtnwCgwQ0R
tOugGBjiygq91cV9wJ5gmHQ=
=2qJn
-----END PGP SIGNATURE-----

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Feb 10, 2009, 1:16 AM

Post #7 of 11 (1339 views)
Permalink
Re: Accessing skins objects [In reply to]

Am 09.02.2009 um 18:53 schrieb Tres Seaver:

> This is talking directly to Zope (no Varnish / Squid in front?)
> Please
> post the PythonScript, too.

Yep, this is a local wget talking directly to Zope.

The PythonScript is:

request = context.REQUEST
styles = []
styles.append(getattr(context,
'content_global.css').index_html(request, request.RESPONSE))
styles.append(getattr(context, 'default.css').index_html(request,
request.RESPONSE))
#... lots more file

return "\n".join(styles)

Now the profile results:
1) View
4499 function calls (4476 primitive calls) in 0.110 CPU seconds

2) PythonScript
12830 function calls (12786 primitive calls) in 0.154 CPU seconds

The 3:1 ratio is probably down to the way index_html works for the
files.

So the PythonScript is more CPU intensive but also delivers faster.
Going on what you suggested yesterday I suspect the difference is down
to how the request is written to. I'll see if I can get something
working with that IFilestreamIterator you suggested.

>>> The FSFile
>>> object *never* stores the bits read from the filesystem, so the more
>>> likely case is that your view is hitting some other bottleneck.
>>
>> oh, what FS things are affected by the debug-mode flag that forces
>> them to be reread?, ie. which objects don't reflect underlying file-
>> system changes?
>
> Other FS objects may have cached information computed from the file
> (e.g., the compiled template bytecode for an FSPageTemplate, or
> bytecode
> for an FSPythonScript). But there is nothing which reads FSFile data
> into memory and holds it. both its '__str__' and its 'index_html'
> reread the file from dist. However, the object *may* be cached by a
> RAMCache or an AcceleratedHTTPCache, if one is configured.

No, very little caching is active at the moment.

> If Globals.DevelopmentMode is enabled, then the call to
> '_updateFromFS'
> in both of those methods ('__str__', 'index_html') removes the object
> from the cache on each request.

Yes, I've seen this is how _readFile() works.

>>> BTW, it might be faster to compute the *filenames* in the memo, and
>>> then
>>> return an IFilestreamIterator which chunked the response by reading
>>> the
>>> files one at a time. Running 'cat /path/to/fsidr/*.js' in an
>>> os.system() call might be faster, too ;)
>>
>>
>> I quite like the iterator idea.
>
>> BTW. Can I admit at this stage that I
>> don't really understand what the memoize method does? 8-)
>
> It caches the result of the method call in the view's instance
> dictionary. Be *sure* to use it only for views: using it on a
> content
> objecct would be disastrous.


I'd read the method and figured that's what it does. But because I'd
never seen the pattern before I wasn't sure. If we do use it, we only
use it views. Having it in browser.utils is a handy hint there. I have
hit problems when combining it with decode - obvious when one thinks
about it - but as all our objects return data in unicode (most are
managed through formlib forms with some stuff stored in an RDBMS with
the driver configured to coerce unicode) decode isn't necessary.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Feb 10, 2009, 2:59 AM

Post #8 of 11 (1337 views)
Permalink
Re: Accessing skins objects [In reply to]

Am 10.02.2009 um 10:16 schrieb Charlie Clark:

> Now the profile results:
> 1) View
> 4499 function calls (4476 primitive calls) in 0.110 CPU seconds
>
> 2) PythonScript
> 12830 function calls (12786 primitive calls) in 0.154 CPU seconds

I've added an interator which reduces the number of calls:

2370 function calls (2362 primitive calls) in 0.041 CPU seconds

But this reduces data transfer still further to between 10 and 20 MB/s!

While I'm convinced that the code is probably better I'm at a loss
about the slowdown. This is the code for comments:

class FilesIterator(object):

size = 0
files = []

def __init__(self, files):
for f, size in files:
self.files.append(f)
self.size += size

def next(self):
while self.files:
f = open(self.files.pop(), "rb")
data = f.read()
f.close()
return data

class Javascript(ViewBase):
"""Return all Javascript from the skin as a single string"""

folder_name = 'js'
content_type = 'application/x-javascript'

@memoize
def contents(self):
skin_tool = getToolByName(self.context, 'portal_skins')
layer = skin_tool.getDefaultSkin()
skin = skin_tool.getSkinByName(layer)
folder = getattr(skin, self.folder_name)
obs = [(ob._filepath, ob.get_size()) for ob in
folder.objectValues()
if ob.meta_type == "Filesystem File"]
fs = FilesIterator(obs)
return fs

def __call__(self):
bundle = self.contents()
self.request.response.setHeader("Content-Type",
self.content_type)
self.request.response.setHeader("Content-Length", bundle.size)
data = bundle.next()
while data:
self.request.response.write(data)
data = bundle.next()

I did look at the file_iterator in ZPublisher.Iterators but I couldn't
see a way to combine that with a list of files.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


tseaver at palladion

Feb 10, 2009, 5:36 AM

Post #9 of 11 (1338 views)
Permalink
Re: Accessing skins objects [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Charlie Clark wrote:
> Am 09.02.2009 um 18:53 schrieb Tres Seaver:
>
>> This is talking directly to Zope (no Varnish / Squid in front?)
>> Please
>> post the PythonScript, too.
>
> Yep, this is a local wget talking directly to Zope.
>
> The PythonScript is:
>
> request = context.REQUEST
> styles = []
> styles.append(getattr(context,
> 'content_global.css').index_html(request, request.RESPONSE))
> styles.append(getattr(context, 'default.css').index_html(request,
> request.RESPONSE))
> #... lots more file
>
> return "\n".join(styles)
>
> Now the profile results:
> 1) View
> 4499 function calls (4476 primitive calls) in 0.110 CPU seconds
>
> 2) PythonScript
> 12830 function calls (12786 primitive calls) in 0.154 CPU seconds
>
> The 3:1 ratio is probably down to the way index_html works for the
> files.
>
> So the PythonScript is more CPU intensive but also delivers faster.
> Going on what you suggested yesterday I suspect the difference is down
> to how the request is written to. I'll see if I can get something
> working with that IFilestreamIterator you suggested.

You could try changing the view to call 'index_html' instead of
'__str__', and see if that helps. If it does, then I think there must
be a RAM cache in play somewhere.


Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver [at] palladion
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJkYLJ+gerLs4ltQ4RAoyoAKDRBVwqzviiNT0W1l28290kE8cx+gCgh6xo
HU3bZxYwmO9p44ZXWolrJiY=
=NaD1
-----END PGP SIGNATURE-----
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


tseaver at palladion

Feb 10, 2009, 5:36 AM

Post #10 of 11 (1340 views)
Permalink
Re: Accessing skins objects [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Charlie Clark wrote:
> Am 09.02.2009 um 18:53 schrieb Tres Seaver:
>
>> This is talking directly to Zope (no Varnish / Squid in front?)
>> Please
>> post the PythonScript, too.
>
> Yep, this is a local wget talking directly to Zope.
>
> The PythonScript is:
>
> request = context.REQUEST
> styles = []
> styles.append(getattr(context,
> 'content_global.css').index_html(request, request.RESPONSE))
> styles.append(getattr(context, 'default.css').index_html(request,
> request.RESPONSE))
> #... lots more file
>
> return "\n".join(styles)
>
> Now the profile results:
> 1) View
> 4499 function calls (4476 primitive calls) in 0.110 CPU seconds
>
> 2) PythonScript
> 12830 function calls (12786 primitive calls) in 0.154 CPU seconds
>
> The 3:1 ratio is probably down to the way index_html works for the
> files.
>
> So the PythonScript is more CPU intensive but also delivers faster.
> Going on what you suggested yesterday I suspect the difference is down
> to how the request is written to. I'll see if I can get something
> working with that IFilestreamIterator you suggested.

You could try changing the view to call 'index_html' instead of
'__str__', and see if that helps. If it does, then I think there must
be a RAM cache in play somewhere.


Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver [at] palladion
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJkYLJ+gerLs4ltQ4RAoyoAKDRBVwqzviiNT0W1l28290kE8cx+gCgh6xo
HU3bZxYwmO9p44ZXWolrJiY=
=NaD1
-----END PGP SIGNATURE-----

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Feb 10, 2009, 7:28 AM

Post #11 of 11 (1343 views)
Permalink
Re: Accessing skins objects [In reply to]

Am 10.02.2009 um 14:36 schrieb Tres Seaver:

> You could try changing the view to call 'index_html' instead of
> '__str__', and see if that helps. If it does, then I think there must
> be a RAM cache in play somewhere.


I actually reckon it's an anomaly down to my rather unscientific
testing with wget. Using Apache's ab I get the following results for
100 requests with 10 concurrent:

Using a PythonScript:

Document Path: /kinopolis/css/styles.css
Document Length: 381936 bytes

Concurrency Level: 10
Time taken for tests: 5.148 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 38234100 bytes
HTML transferred: 38193600 bytes
Requests per second: 19.43 [#/sec] (mean)
Time per request: 514.787 [ms] (mean)
Time per request: 51.479 [ms] (mean, across all concurrent
requests)
Transfer rate: 7253.10 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.6 0 15
Processing: 138 501 111.9 493 813
Waiting: 125 459 106.6 453 783
Total: 139 501 112.0 493 813

Percentage of the requests served within a certain time (ms)
50% 493
66% 548
75% 572
80% 600
90% 644
95% 716
98% 724
99% 813
100% 813 (longest request)


Using a BrowserView:

Document Path: /kinopolis/kinopolis.css
Document Length: 238676 bytes

Concurrency Level: 10
Time taken for tests: 2.346 seconds
Complete requests: 100
Failed requests: 99
(Connect: 0, Receive: 0, Length: 99, Exceptions: 0)
Write errors: 0
Total transferred: 40933800 bytes
HTML transferred: 40914700 bytes
Requests per second: 42.63 [#/sec] (mean)
Time per request: 234.559 [ms] (mean)
Time per request: 23.456 [ms] (mean, across all concurrent
requests)
Transfer rate: 17042.33 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.8 0 3
Processing: 58 233 68.5 229 386
Waiting: 14 39 29.9 32 181
Total: 58 233 68.7 229 386

Percentage of the requests served within a certain time (ms)
50% 229
66% 259
75% 281
80% 294
90% 318
95% 363
98% 378
99% 386
100% 386 (longest request)

These figures tally in with the Profiler's results although I'm not
quite sure where the difference in document length comes from.

Thanks very much for the tip.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.