[newbie] Removing MySQL calls from PHP pages?
[newbie] Removing MySQL calls from PHP pages?
am 13.01.2008 19:54:40 von DFS
Hello
Out of curiosity, is there a way to avoid putting calls to MySQL in
pages, and have PHP fetch data from a common pool, so that all
connected users don't actually call MySQL directly, but simply read
data from that common pool?
Just an idea. I don't know if it makes any sense :-)
Thanks.
Re: [newbie] Removing MySQL calls from PHP pages?
am 13.01.2008 20:06:38 von Peter Pei
not too meaningful, as the database is the common pool. If the idea is to
pool most recent data, so that subsequent calls put lighter pressure on db,
then I sure hope mysql does that itself.
Re: [newbie] Removing MySQL calls from PHP pages?
am 13.01.2008 20:08:42 von Peter Pei
you can opt to have some middle man there, but then you lost all the benefit
that the db gives you. the cost benefit is real problem.
Re: [newbie] Removing MySQL calls from PHP pages?
am 13.01.2008 20:33:59 von thyb0
Gilles Ganault wrote:
> Hello
>
> Out of curiosity, is there a way to avoid putting calls to MySQL in
> pages, and have PHP fetch data from a common pool, so that all
> connected users don't actually call MySQL directly, but simply read
> data from that common pool?
>
> Just an idea. I don't know if it makes any sense :-)
>
> Thanks.
I guess you're thinking about a cache concept, you should read some articles
about it; this can indeed be very useful if the database is submerged by
loads of identical, heavy search requests.
-thib´
Re: [newbie] Removing MySQL calls from PHP pages?
am 13.01.2008 20:36:35 von DFS
On Sun, 13 Jan 2008 19:08:42 GMT, "Peter Pei"
wrote:
>you can opt to have some middle man there, but then you lost all the benefit
>that the db gives you. the cost benefit is real problem.
OK. So high-performance PHP applications are also sprinkled with calls
to MySQL, just like my newbie pages?
So, if I want higher perfs, and supposing that the MySQL part is
optimized as much as it can, the only option is to get a faster
server?
Re: [newbie] Removing MySQL calls from PHP pages?
am 13.01.2008 20:48:17 von DFS
On Sun, 13 Jan 2008 20:33:59 +0100, thib´
wrote:
>I guess you're thinking about a cache concept, you should read some articles
>about it; this can indeed be very useful if the database is submerged by
>loads of identical, heavy search requests.
OK, I'll do some tests and see how it goes, even by keeping actually
MYSQL calls in all the pages. Thanks.
Re: [newbie] Removing MySQL calls from PHP pages?
am 13.01.2008 21:09:45 von Jerry Stuckle
Gilles Ganault wrote:
> On Sun, 13 Jan 2008 19:08:42 GMT, "Peter Pei"
> wrote:
>> you can opt to have some middle man there, but then you lost all the benefit
>> that the db gives you. the cost benefit is real problem.
>
> OK. So high-performance PHP applications are also sprinkled with calls
> to MySQL, just like my newbie pages?
>
Sure, all over the place.
> So, if I want higher perfs, and supposing that the MySQL part is
> optimized as much as it can, the only option is to get a faster
> server?
>
Yes, but I find in most systems MySQL is not optimized as much as possible.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: [newbie] Removing MySQL calls from PHP pages?
am 13.01.2008 21:29:36 von DFS
On Sun, 13 Jan 2008 15:09:45 -0500, Jerry Stuckle
wrote:
>Sure, all over the place.
I'd love to see some actual before/after code to see the impact on the
different ways to build CRUD apps in LAMP.
>Yes, but I find in most systems MySQL is not optimized as much as possible.
Where do they most often fail?
Re: [newbie] Removing MySQL calls from PHP pages?
am 13.01.2008 21:41:18 von Norman Peelman
Gilles Ganault wrote:
> On Sun, 13 Jan 2008 20:33:59 +0100, thib´
> wrote:
>> I guess you're thinking about a cache concept, you should read some articles
>> about it; this can indeed be very useful if the database is submerged by
>> loads of identical, heavy search requests.
>
> OK, I'll do some tests and see how it goes, even by keeping actually
> MYSQL calls in all the pages. Thanks.
MySQL has a cache of its own... mysql_query_cache... search the mysql
website. And then there are caches like APC (Alternative PHP Cache) for PHP.
--
Norman
Registered Linux user #461062
Re: [newbie] Removing MySQL calls from PHP pages?
am 13.01.2008 21:47:38 von DFS
On Sun, 13 Jan 2008 15:41:18 -0500, Norman Peelman
wrote:
> MySQL has a cache of its own... mysql_query_cache... search the mysql
>website. And then there are caches like APC (Alternative PHP Cache) for PHP.
Thanks.
Re: [newbie] Removing MySQL calls from PHP pages?
am 13.01.2008 21:49:40 von Jerry Stuckle
Gilles Ganault wrote:
> On Sun, 13 Jan 2008 15:09:45 -0500, Jerry Stuckle
> wrote:
>> Sure, all over the place.
>
> I'd love to see some actual before/after code to see the impact on the
> different ways to build CRUD apps in LAMP.
>
>> Yes, but I find in most systems MySQL is not optimized as much as possible.
>
> Where do they most often fail?
>
Lots of places. Anywhere from improper normalization to incorrect
indexes to poor MySQL optimization.
It takes time and effort to properly optimize MySQL - just like with any
other RDBMS.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: [newbie] Removing MySQL calls from PHP pages?
am 14.01.2008 11:37:08 von Jonas Werres
> Out of curiosity, is there a way to avoid putting calls to MySQL in
> pages, and have PHP fetch data from a common pool, so that all
> connected users don't actually call MySQL directly, but simply read
> data from that common pool?
>
> Just an idea. I don't know if it makes any sense :-)
Possibility 1: You always need the same data. Then you can cache the pages.
Possibility 2: You need different data every time. Then what makes you think
the a crappy script language can provide them better than a dedicated db
engine?
I made the experience, that beyond all mysql optimisation and stuff, the
most common failure is to underestimate the db engine.
Re: Removing MySQL calls from PHP pages?
am 14.01.2008 14:22:06 von tyler.style.post
On Jan 13, 11:54 am, Gilles Ganault wrote:
> Hello
>
> Out of curiosity, is there a way to avoid putting calls to MySQL in
> pages, and have PHP fetch data from a common pool, so that all
> connected users don't actually call MySQL directly, but simply read
> data from that common pool?
>
> Just an idea. I don't know if it makes any sense :-)
>
> Thanks.
My 2 bits: optimizing your queries so as to make the least number of
calls to your DB while pulling back the most compact amount of info
possible is definitely something to check for. When I was a computing
science TA, every so often I'd see the horror of people making a
database call inside of a loop :) Another one was making separate
pulls from several tables for related data, instead of using a join
and so pulling just once.
Tyler
Re: Removing MySQL calls from PHP pages?
am 14.01.2008 14:41:05 von DFS
On Mon, 14 Jan 2008 05:22:06 -0800 (PST), tyler.style.post@gmail.com
wrote:
>My 2 bits: optimizing your queries so as to make the least number of
>calls to your DB while pulling back the most compact amount of info
>possible is definitely something to check for.
Thanks for the tip. I guess I should really forget the simplistic
examples with the view pages sprinkled with calls to MySQL, and
investigate MVC-based frameworks like CakePHP or Smarty instead.
Re: [newbie] Removing MySQL calls from PHP pages?
am 14.01.2008 14:42:04 von DFS
On Mon, 14 Jan 2008 11:37:08 +0100, Jonas Werres
wrote:
>I made the experience, that beyond all mysql optimisation and stuff, the
>most common failure is to underestimate the db engine.
Good to know. Thanks.
Re: Removing MySQL calls from PHP pages?
am 15.01.2008 00:41:46 von Norman Peelman
Gilles Ganault wrote:
> On Mon, 14 Jan 2008 05:22:06 -0800 (PST), tyler.style.post@gmail.com
> wrote:
>> My 2 bits: optimizing your queries so as to make the least number of
>> calls to your DB while pulling back the most compact amount of info
>> possible is definitely something to check for.
>
> Thanks for the tip. I guess I should really forget the simplistic
> examples with the view pages sprinkled with calls to MySQL, and
> investigate MVC-based frameworks like CakePHP or Smarty instead.
Gilles,
I've not used Smarty or CakePHP, but I do use the template system
found here:
http://www.phpclasses.org/trackback/browse/package/54.html
....it's extremely fast and seems to do just what I need.
--
Norman
Registered Linux user #461062
Re: Removing MySQL calls from PHP pages?
am 15.01.2008 02:36:32 von DFS
On Mon, 14 Jan 2008 18:41:46 -0500, Norman Peelman
wrote:
> I've not used Smarty or CakePHP, but I do use the template system
>found here:
>
>http://www.phpclasses.org/trackback/browse/package/54.html
Thanks. The URL is apparently:
http://www.phpclasses.org/browse/package/54.html
I'll give it a shot.
Re: Removing MySQL calls from PHP pages?
am 15.01.2008 04:01:15 von Aaron Saray
On Jan 13, 2:41 pm, Norman Peelman wrote:
> Gilles Ganault wrote:
> > On Sun, 13 Jan 2008 20:33:59 +0100, thib=B4
> > wrote:
> >> I guess you're thinking about a cache concept, you should read some art=
icles
> >> about it; this can indeed be very useful if the database is submerged b=
y
> >> loads of identical, heavy search requests.
>
> > OK, I'll do some tests and see how it goes, even by keeping actually
> > MYSQL calls in all the pages. Thanks.
>
> MySQL has a cache of its own... mysql_query_cache... search the mysql
> website. And then there are caches like APC (Alternative PHP Cache) for PH=
P.
>
> --
> Norman
> Registered Linux user #461062
And don't forget about 'memcache' - a mysql cache.