Re: Using a single php entry file for a whole site. [message #181895 is a reply to message #181892] |
Fri, 21 June 2013 10:21 |
The Natural Philosoph
Messages: 993 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 21/06/13 10:08, Tim Streater wrote:
> In article <kq0sqh$vlb$1(at)news(dot)albasani(dot)net>,
> The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
>
>> On 20/06/13 23:50, Christoph Michael Becker wrote:
>>> Am 21.06.2013 00:33, schrieb Marc van Lieshout:
>>>> Why is using ob_start() poor programming?
>>>> The pair ob_start/ob_get_clean captures the contents of the page
>> in the
>>>> $contents variable.
>>> This discussion may well end in a flame war. What is faster: echoing
>>> with output buffering vs. concatening strings with the dot operator?
>>>
>>> ISTM all depends on the implementation. AFAIK string concatenation
>> is a
>>> very cheap operation in Python, for instance, as the string is not
>>> actually built (merely a "pseudo" string containing links to the
>>> concatenated strings). In other languages such as PHP, the characters
>>> have to be copied over to a new string, AFAIK. This probably makes
>>> output buffering faster, but the performance difference may be
>>> neglectable for typical cases. And one never knows, if the
>>> implementation might change in the future.
>>>
>> And the killer point, it is in terms of the overall site, the least
>> of ones worries.
>>
>> By far and away the biggest performance killer is accessing and
>> streaming large objects. Generally graphics and videos.
>>
>> or downloading massive JavaScript includes.
>>
>> I've got one site which auto refreshes a page, I expected it to be
>> massively hungry as its pretty popular, but somehow if the images
>> haven't changed or the page hasn't changed it manages to only send
>> the bits that have changed.
>
> Isn't that just my browser caching stuff? If I've restarted Safari or
> rebooted (less likely) or just cleared the cache by hand it's gonna
> need to get it all next time I have a look.
>
the odd thing is Tim (and I know you know which site it is) that how
does the browser know when its time to fetch the updated copy?
In the logs apache mixes 200 responses with 304 responses.
Vis:
304 Not Modified
If the client has performed a conditional GET request and access is
allowed, but the document has not been modified, the server SHOULD
respond with this status code. The 304 response MUST NOT contain a
message-body, and thus is always terminated by the first empty line
after the header fields.
The response MUST include the following header fields:
- Date, unless its omission is required by section 14.18.1
If a clockless origin server obeys these rules, and proxies and clients
add their own Date to any response received without one (as already
specified by [RFC 2068], section 14.19
<http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19>),
caches will operate correctly.
- ETag and/or Content-Location, if the header would have been sent
in a 200 response to the same request
- Expires, Cache-Control, and/or Vary, if the field-value might
differ from that sent in any previous response for the same
variant
If the conditional GET used a strong cache validator (see section
13.3.3), the response SHOULD NOT include other entity-headers. Otherwise
(i.e., the conditional GET used a weak validator), the response MUST NOT
include other entity-headers; this prevents inconsistencies between
cached entity-bodies and updated headers.
If a 304 response indicates an entity not currently cached, then the
cache MUST disregard the response and repeat the request without the
conditional.
If a cache uses a received 304 response to update a cache entry, the
cache MUST update the entry to reflect any new field values given in the
response.
-------------
OK all fair and good, but how in fact does apache know that the data has
not been modified since that particular client last accessed it?
Its working like a dream for sure - 99% of all the hits are 304's - but
how can I make sure it always does?
--
Ineptocracy
(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
|
|
|