Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Thoughts about Class::DBI and MySQL performance

by doom (Deacon)
on Apr 30, 2005 at 21:23 UTC ( [id://452932]=note: print w/replies, xml ) Need Help??


in reply to Best way to do caching of Class::DBI objects from a MySQL database

My short answer is "gee, I don't know", but since no one else has answered yet, I'll throw some thoughts out:

  1. Have you looked into MySQL replication? You might be able to run duplicates of the database locally on your webservers. (Note: I've heard that MySQL replication is flaky, but then I'm a postgresql snob -- nearly everything related to MySQL seems a little flaky to me.)
  2. Have you looked for MySQL administration tricks to speed up the database? Some years back, Tim Perdue tried to benchmark MySQL against PostgreSQL and came to the conclusion that despite it's reputation MySQL wasn't particularly fast. The response of the MySQL camp was that he just didn't know what he was doing, the database wasn't tuned right, etc. This would seem to indicate there are some tuning secrets that the insiders know, so what are they?
  3. Maybe you need to think about how you're using Class::DBI. I've been looking at it recently, and my first take is that it makes OOP persistance easy to do at the expense of crippling the database access. It used to be considered a rank newbie mistake to do multiple selects instead of one that uses a table join, but Class::DBI encourages you to do just that. You might want to look into writing some custom queries to dodge around Class::DBI bottlenecks.
  4. Your ideas about using Cache::Cache or Class::DBI::Cacheable also sound reasonable, but I don't know what to say about your update problem. The kind of thing I usually see done is have the cache expire after a certain fixed period of time, but if you can't live with the data being stale for any substantial length of time that obviously doesn't work for you.

    Hopefully someone else will have something more definite for you (though I predict you're going to hear some advice about doing profiling to make sure you know where the bottlenecks are).

    • Comment on Thoughts about Class::DBI and MySQL performance

Replies are listed 'Best First'.
Re: Thoughts about Class::DBI and MySQL performance
by doom (Deacon) on May 03, 2005 at 16:35 UTC
    Maybe you need to think about how you're using Class::DBI. I've been looking at it recently, and my first take is that it makes OOP persistance easy to do at the expense of crippling the database access. It used to be considered a rank newbie mistake to do multiple selects instead of one that uses a table join, but Class::DBI encourages you to do just that. You might want to look into writing some custom queries to dodge around Class::DBI bottlenecks.
    I see that dragonchild has already written extensively about this problem:
    OO concepts and relational databases.
    He doesn't name Class::DBI until late in the article, but Class::DBI definitely falls into the class of things under discussion.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://452932]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-20 03:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found