[geeklog-devel] Pear DB Overhead
Tom Willett
tomw at pigstye.net
Thu Feb 6 21:25:27 EST 2003
On Thu, 06 Feb 2003 17:57:24 -0600, Tony Bibbs wrote
> Well, the requirements for GL2 as they stand now are to support multiple
> backends. ADODB and PEAR::DB do this and, according to that link I
> just posted, they are fairly comparable. You give up speed for
> flexibility in this case. We could write our own lite DBMS abstraction
> layer but I don't see much value in reinventing the wheel.
>
> Tom, I think many of your issues can be addressed in code.
That was one point that I brought as a way to speed things up. One of the
things about the current geeklog setup that contributes (maybe the major
cause) to the slowness is the kitchen sink style approach where everything
is loaded for every page. Tell me another approach will be used in GL2.
> For example,
> the new session library will reduce the 3 or 4 calls made to get data
> about a user and compress it into one call. I think there are many
> instances where DB_count in the 1.3.x code is used to get a count for
> something that really isn't needed.
This is what is needed.
In fact our mantra as we develop
> GL2 should be "less is more".
At least as far as database calls go. I come from the days of writing
assembly language that modified itself -- a real mess to debug and
maintain. I will take well structured readable code to short hacks any day.
> Are you willing to stick with MySQL as a
> requirement for GL2? We can bring that back up as a discussion point if
> you want. Personally, I think pigeon holing ourselves to one DBMS is
> unwise if you want to put GL2 in the hands of as many users as possible.
I think opening up geeklog to use by other databases is great -- I, however,
wasn't aware of the performance penalty that would be incurred. I just
think that we should work doubly hard to reduce the number of required
database calls by building structures to cache the data we do retrieve.
> I'd appreciate the input from you other developers here as I don't
> want to sound like a lone-renegade programmer out doing whatever he
> wants, when he wants. There was concensus on this at one point and we
> tossed around these very things.
>
And I do not want to shake that concensus. I just do not want to get 3/4 of
the way into the coding and find it is too slow.
> What in the design of GL2 do you see getting worse? I couldn't disagree
> more with your view point here.
The design issue that I think can make this worse is the idea of several
independent modules. I can just see several modules needing e.g. user
information and each one making several db calls to get what they want. The
potential for redundant calls is real. In the current Geeklog this is
mitigated by a unified system that shares information, e.g the $_USER
array. We need a flexible system for caching data and sharing it with the
other modules. I would be in favor of not giving a module direct access to
the core geeklog tables or to the tables of another module -- making them
access them through the module interface. Then each module would be
responsible for deciding what should be cached.
Lets take my menu plugin in the current geeklog. It borrows code from lib-
common to display the topics and the user and admin menus. On nearly every
page that is displayed several calls to dbcount are made to get the totals
for each topic and the admin menu. It would speed things up greatly to have
a table that contained these totals and therefore need only one database
call would need to be made. I considered doing this, however, making all
the database calls and updating the database of totals caused a noticable
delay every 20 pages, which is how often I choose to update the totals. To
do it right would require cooperation between the menu plugin, the main
geeklog system, as well as every other plugin.
TomW
> --Tony
>
> Tom Willett wrote:
> > So with the enhancements its only 1/2 speed instead of 1/3 speed?
> >
> > My concern is that even now people complain about speed. When they see
that
> > it takes twice as long to render a page, they will really complain.
Much of
> > the speed issue now is because of uneeded and redundant db calls done in
the
> > name of programming ease. As I see the design of GL2, this will only
get
> > worse. A bunch of independent modules do not tend to share the
information
> > they pulled from the db.
> >
> > Tom
> >
> > On Thu, 6 Feb 2003 16:09:32 -0600 (CST), Tony Bibbs wrote
> >
> >>Read this:
> >>
> >>http://marc.theaimsgroup.com/?l=pear-dev&m=100793507904834&w=2
> >>
> >>Sleep easier now?
> >>
> >>--Tony
> >>
> >>On Thu, 6 Feb 2003, Tom Willett wrote:
> >>
> >>
> >>>Was surfing around and say this rather disturbing bit of info about php
> >
> > and
> >
> >>>databases. Well to put it simply PEAR DB appears to be about three
> >
> > times
> >
> >>>slower that mysql -- here are the benchmark times.
> >>>
> >>> Average Overhead
> >>>MySQL 1.14 -
> >>>dbx 1.37 20% (index only)
> >>>ADODB 1.45 27%
> >>>dbx 1.53 34% (index/assoc/info)
> >>>PhpLib 1.60 40%
> >>>MDB 1.75 54%
> >>>PEAR DB 2.87 152% (fetchInto)
> >>>PEAR DB 3.15 176% (fetchRow)
> >>>M'base 2.52 296% (numeric cols)
> >>>M'base 4.77 318% (assoc cols)
> >>>
> >>>
> >>>
> >>>and a link to the full article.
> >>>
> >>>http://phplens.com/lens/adodb/
> >>>
> >>>--
> >>>Tom Willett
> >>>tomw at pigstye.net
> >>>_______________________________________________
> >>>geeklog-devel mailing list
> >>>geeklog-devel at lists.geeklog.net
> >>>http://lists.geeklog.net/listinfo/geeklog-devel
> >>>
> >>
> >>--
> >>------------------------------------------------------------------------|
> >>Tony Bibbs | "I guess you have to remember that those who don't
> >
> > |
> >
> >>tony at tonybibbs.com | hunt or fish often see those of us who do as |
> >> | harmlessly strange and sort of amusing. When you
|
> >> | think about it, that might be a fair assessment."
|
> >> | --Unknown |
> >>------------------------------------------------------------------------|
> >>
> >>_______________________________________________
> >>geeklog-devel mailing list
> >>geeklog-devel at lists.geeklog.net
> >>http://lists.geeklog.net/listinfo/geeklog-devel
> >
> >
> >
> >
> > --
> > Tom Willett
> > tomw at pigstye.net
> > _______________________________________________
> > geeklog-devel mailing list
> > geeklog-devel at lists.geeklog.net
> > http://lists.geeklog.net/listinfo/geeklog-devel
>
> --
> +-------------------+--------------------------------------------------+
> |Tony Bibbs |[R]egardless of what you may think of our penal |
> |tony at tonybibbs.com |system, the fact is that every man in jail is one |
> | |less potential fisherman to clutter up your |
> | |favorite pool or pond. --Ed Zern |
>
> +-------------------+--------------------------------------------------+
>
> _______________________________________________
> geeklog-devel mailing list
> geeklog-devel at lists.geeklog.net
> http://lists.geeklog.net/listinfo/geeklog-devel
--
Tom Willett
tomw at pigstye.net
More information about the geeklog-devel
mailing list