473,465 Members | 1,946 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Separating static and dynamic contents?

Hi

One of the ways to raise performance for PHP apps is to
separate static contents from dynamic contents, so that the former can
be compiled once into cache.

Can someone give me a simple example of how this kind of thing is done
when making calls to MySQL?

Thank you.
Jan 6 '08 #1
14 1529
Gilles Ganault wrote:
Hi

One of the ways to raise performance for PHP apps is to
separate static contents from dynamic contents, so that the former can
be compiled once into cache.

Can someone give me a simple example of how this kind of thing is done
when making calls to MySQL?

Thank you.
Gilles,

Displaying static output from a PHP page isn't that much overhead. I
doubt you'll even begin to notice the difference until you're running
hundreds of hits per second.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jan 6 '08 #2
Gary L. Burnore wrote:
On Sun, 06 Jan 2008 14:26:32 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>>Gilles Ganault wrote:
>>Hi

One of the ways to raise performance for PHP apps is to
separate static contents from dynamic contents, so that the former
can be compiled once into cache.

Can someone give me a simple example of how this kind of thing is
done when making calls to MySQL?

Thank you.

Gilles,

Displaying static output from a PHP page isn't that much overhead. I
doubt you'll even begin to notice the difference until you're running
hundreds of hits per second.

While YOUR sites may only get a hundred hits per seconds but REAL
websites can get much more.
I don't recall Jerry stating anything about how many hits per second his
sites get?

Also, SOME people can actually string a sentence together using the correct
words.

Seems reading posts and writing them are not amongst your strong points!
Jan 6 '08 #3
Gary L. Burnore wrote:
On Sun, 06 Jan 2008 14:26:32 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>Gilles Ganault wrote:
>>Hi

One of the ways to raise performance for PHP apps is to
separate static contents from dynamic contents, so that the former can
be compiled once into cache.

Can someone give me a simple example of how this kind of thing is done
when making calls to MySQL?

Thank you.
Gilles,

Displaying static output from a PHP page isn't that much overhead. I
doubt you'll even begin to notice the difference until you're running
hundreds of hits per second.

While YOUR sites may only get a hundred hits per seconds but REAL
websites can get much more.
I OWN YOU, Gary! ROFLMAO!

I said NOTHING about my sites!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jan 6 '08 #4
On Sun, 06 Jan 2008 14:26:32 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>Displaying static output from a PHP page isn't that much overhead.
Good to know. But if PHP pages contain connections to MySQL, their
contents is dynamic, so their opcode cannot be compiled once and kept
in cache? How do real life apps handle this?
Jan 6 '08 #5
Gilles Ganault wrote:
On Sun, 06 Jan 2008 14:26:32 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>Displaying static output from a PHP page isn't that much overhead.

Good to know. But if PHP pages contain connections to MySQL, their
contents is dynamic, so their opcode cannot be compiled once and kept
in cache? How do real life apps handle this?
The PHP code can still be compiled and cached. The results from MySQL
is data, not operations.

And unless you are running an accelerator, the code isn't cached anyway.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jan 7 '08 #6
NC
On Jan 6, 10:58 am, Gilles Ganault <nos...@nospam.comwrote:
>
One of the ways to raise performance for PHP apps is to separate
static contents from dynamic contents, so that the former can be
compiled once into cache.

Can someone give me a simple example of how this kind of thing is
done when making calls to MySQL?
It's not; you are confusing caching content with caching database
queries.

If you cache content, you put a caching proxy server between your
application and the Internet; the proxy server receives a request from
the Internet and either serves a cached copy of the page being
requested, if it's available, or gets the page from your application,
serves it out and stores a copy in the cache for future use.

If you cache queries, you simply turn on query caching in the MySQL
server; no specific calls from the application are necessary. If you
have queries that are executed often, query caching ensures they are
not executed each time, but rather, their results are retrieved from
cache.

Cheers,
NC
Jan 7 '08 #7
On Sun, 06 Jan 2008 20:48:55 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>The PHP code can still be compiled and cached. The results from MySQL
is data, not operations.
So for an accelerator like APC or eaccelerator, I must pay attention
to separating code and display, or those tools won't be able to keep
the op-code in cache.
Jan 7 '08 #8
On Sun, 6 Jan 2008 18:41:32 -0800 (PST), NC <nc@iname.comwrote:
>It's not; you are confusing caching content with caching database
queries.
Thanks for the clarification.
>If you cache queries, you simply turn on query caching in the MySQL
server; no specific calls from the application are necessary.
Am I right in saying that MySQL doesn't care from which web user the
query is coming: As long as it's in the DB cache, ie. it's a query
that is often made from web user, regardless of who they are, it will
be sent to the PHP process, significantly improving performance since
MySQL won't actually have to compute it and access the hard disk?
Jan 7 '08 #9
On 7 Jan, 07:04, Gilles Ganault <nos...@nospam.comwrote:
On Sun, 6 Jan 2008 18:41:32 -0800 (PST), NC <n...@iname.comwrote:
It's not; you are confusing caching content with caching database
queries.

Thanks for the clarification.
If you cache queries, you simply turn on query caching in the MySQL
server; no specific calls from the application are necessary.

Am I right in saying that MySQL doesn't care from which web user the
query is coming: As long as it's in the DB cache, ie. it's a query
that is often made from web user, regardless of who they are, it will
be sent to the PHP process, significantly improving performance since
MySQL won't actually have to compute it and access the hard disk?
If it's in the MySQL cache, yes.

If your pages don't change particularly quickly, you should be looking
at setting caching information via the header() function and using a
caching reverse proxy.

C.
Jan 7 '08 #10
Gilles Ganault wrote:
On Sun, 06 Jan 2008 20:48:55 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>The PHP code can still be compiled and cached. The results from MySQL
is data, not operations.

So for an accelerator like APC or eaccelerator, I must pay attention
to separating code and display, or those tools won't be able to keep
the op-code in cache.
No, I didn't say that. You're confusing the code, which can be compiled
and cached, with the data, which is not.

Code for maintainability. Performance wise, you won't notice a
difference until you're running hundreds of hits per second. And if
you're getting that many hits, you'll see other performance problems first.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jan 7 '08 #11
Gilles Ganault wrote:
On Sun, 6 Jan 2008 18:41:32 -0800 (PST), NC <nc@iname.comwrote:
>It's not; you are confusing caching content with caching database
queries.

Thanks for the clarification.
>If you cache queries, you simply turn on query caching in the MySQL
server; no specific calls from the application are necessary.

Am I right in saying that MySQL doesn't care from which web user the
query is coming: As long as it's in the DB cache, ie. it's a query
that is often made from web user, regardless of who they are, it will
be sent to the PHP process, significantly improving performance since
MySQL won't actually have to compute it and access the hard disk?
That is true. The same query will just return data from cache. Just
like if two processes read the same file, the OS will return the data
from cache on the second request.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jan 7 '08 #12
On Mon, 07 Jan 2008 07:50:55 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>No, I didn't say that. You're confusing the code, which can be compiled
and cached, with the data, which is not.
Got it. Thanks.
Jan 7 '08 #13
On Mon, 7 Jan 2008 04:42:08 -0800 (PST), "C.
(http://symcbean.blogspot.com/)" <co************@gmail.comwrote:
>If your pages don't change particularly quickly, you should be looking
at setting caching information via the header() function and using a
caching reverse proxy.
I'll read up on what those things are. Thanks.
Jan 7 '08 #14
NC
On Jan 6, 11:04 pm, Gilles Ganault <nos...@nospam.comwrote:
On Sun, 6 Jan 2008 18:41:32 -0800 (PST), NC <n...@iname.comwrote:
If you cache queries, you simply turn on query caching in the MySQL
server; no specific calls from the application are necessary.

Am I right in saying that MySQL doesn't care from which web user the
query is coming: As long as it's in the DB cache, ie. it's a query
that is often made from web user, regardless of who they are, it will
be sent to the PHP process, significantly improving performance since
MySQL won't actually have to compute it and access the hard disk?
Yes, as long as the repeating queries are identical, byte for byte.

Cheers,
NC
Jan 7 '08 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: jordan | last post by:
I'm using the Server.Execute method to include a static page inside a dynamic database call. This static page is not a valid HTML page (i.e. lacking <body>,<head>, etc. elements), but I'm pulling...
6
by: Dumitru Sipos | last post by:
Hello everybody! is there possible to have a function that is both static and virtual? Dumi.
8
by: Peter B. Steiger | last post by:
The latest project in my ongoing quest to evolve my brain from Pascal to C is a simple word game that involves stringing together random lists of words. In the Pascal version the whole array was...
2
by: raxitsheth | last post by:
I am using array in my progrm... is there any tool /tips so that i can convert my program to Dynamic Array...so that I can Add more Element to Array.... Code is around 4000 line 'C' (not C++)...
6
by: Chad Z. Hower aka Kudzu | last post by:
I want to do this. I want my programmers to do all the code. All of it - run at server and run at client. I then want a graphic artist to make the look and the layout of the pages. The...
13
by: Krivenok Dmitry | last post by:
Hello all! Perhaps the most important feature of dynamic polymorphism is ability to handle heterogeneous collections of objects. ("C++ Templates: The Complete Guide" by David Vandevoorde and...
5
by: pittendrigh | last post by:
There must be millions of dynamically generated html pages out there now, built by on-the-fly php code (and jsp, perl cgi, asp, etc). Programatic page generation is transparently useful. But...
24
by: Ken | last post by:
In C programming, I want to know in what situations we should use static memory allocation instead of dynamic memory allocation. My understanding is that static memory allocation like using array...
7
by: Jo | last post by:
Hi, How can i differentiate between static and dynamic allocated objects? For example: void SomeFunction1() { CObject *objectp = new CObject; CObject object;
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.