[Maypole] Re: Maypole responding to requests very slowly (or, how to get just one associated record instead of getting the world)

Simon Flack sf@flacks.net
Wed, 1 Dec 2004 22:59:31 +0000


On Tue, 30 Nov 2004 09:20:33 -0500, Brian Glass wrote
> Simon Flack wrote:
> 
> >Forgive me if I'm barking up the wrong tree here, but isn't this a
> >Class::DBI::AsForm issue? I seem to remember suggestions that setting the
> >Essentials columns appropriately in your CDBI classes would give significant
> >performance improvements. Have you tried that, and if so, did it help?
> >
> >I was also under the impression that the default templates were just examples:
> >    http://lists.netthink.co.uk/pipermail/maypole/2004-November/000975.html
> >
> >I'd like to see them stay that way and not over-complicate them. If there is a
> >demand for drop-in templates, I suggest creating Maypole separate "theme
packs".
> >
> >--simonflk
> >
> 
> Yes it is (an AsForm issue that is). The suggestion to set Essential 
> columns does indeed help performance - and quite a bit too. But it's 
> still not enough. When you get back a result set of 3000 rows and 
> proceed to convert that all to Class::DBI objects and then turn 
> right around and convert them all to HTML::Element objects, and then 
> convert them all to HTML it tends to slow things down a bit.

Yes, I imagine that would have an impact on performance!

> Going straight from a simple array to HTML in a template is much 
> quicker. It makes the difference between a very sluggish application 
> and a very snappy application.
> 
> And something still needs to be done about the $classmetadata->{cgi} 
> auto-creation. I have it commented out in my version of 
> Maypole::View::Base. If you have any significant ammount of real 
> data it causes extreme slowness.

Agreed, but it depends on your data.  I think the problem is that
CDBI::AsForm->to_cgi (which is what populates classmetadata.cgi) creates the
HTML for all the columns (disregarding Essentials).  I suppose that's a pretty
sensible default since it makes it very easy to get started with Maypole.  You
just need an easy way of tuning it/turning it off without resorting to
sublassing the model. After all, in M::V::TT at least, you can still do this:

    [% object.to_field('column', 'select').as_HTML %]

> I was nearly at the point of giving up on Maypole and going straight 
> to Class::DBI and HTML::Mason and then I tried these two tweaks and 
> all is well. I'm actually surprised that nobody else has had these 
> performance problems. Is anyone else out there using large amounts 
> of real-world data in thier apps?
> 
> No biggie on the factory templates. I don't really use them much 
> anyway so I don't care, but it might be nice for beginners to see...
> 
> I think it might be nice to have a thread with real-life examples of 
> successful Maypole applications. I started using my Maypole app in a 
> real-life setting on Sunday. I'm developing a church management 
> system and we're doing child registration with photo ID cards and 
> the like. We've got over 300 kids per Sunday so we need something 
> that can match up kids with parents (there are 3465 people in our 
> database) in a secure way. The app will be GPL and I'll be setting 
> it up on sourceforge sometime in the next couple months. The 
> application will take photos using any webcam (either an IP camera 
> or using camsource), print a plastic ID card (using a custum perl 
> Zebra printer driver), read the barcode on the card (using a 
> keyboard wedge barcode scanner), print stickers (DYMO printers) to 
> put on the kids, and keep track of attendance. We're using firefox 
> as the browser and will be setting up kiosks based on LTSP with ELO 
> touch screens for people to sign in at and scan thier cards. It all 
> runs from a Dell Inspirion 1100 laptop since it has to be 
> portable... And it's all Maypole driven.
> 
> Anyone else? (might want to start a new thread)
> 
> _______________________________________________
> maypole mailing list
> maypole@lists.netthink.co.uk
> http://lists.netthink.co.uk/listinfo/maypole


--simonflk