Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-05-24 12:29:32

etc
Developer
Registered: 2010-11-11
Posts: 5,189
Website GitHub

Proposal: optimize Last-Modified handle entry

If we inspect the trace logs of a typical txp public site, the common cycle-eaters could look like this:

<!-- Trace summary:
Runtime   : 39.74 ms
...
-->

<!-- Trace log:
  Time(ms) | Duration | Trace
      0.66 |     5.76 | [PHP includes, stage 1]
      7.76 |    12.12 | [PHP includes, stage 2]
      ...
     22.51 |     4.33 | [SQL: SELECT name, data FROM txp_lang WHERE lang = 'en' AND name != '' AND (event IN ('public','common') OR owner != '') ]
     27.11 |     5.30 | [Loading plugins]

But most of these operations (loading libraries, language strings, plugins) are useless in Live mode on successive visits if the site has not changed, since finally txp just sends 304 Not Modified header and exits. The browser then pulls the page from its cache anyway.

Could we send this header a little earlier, at least before language strings and plugins are loaded? The main issue is that some plugins might need to alter the normal processing (say, redirect to somewhere else or write to db) before handle_lastmod() is called. I would suggest that only those assigned a loading order below some threshold (5? 3? even 0?) are loaded at early stages, but this is not totally bw-compatible.

Any better suggestion, to make txp a little greener?

Offline

#2 2019-05-25 09:24:19

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,189
Website

Re: Proposal: optimize Last-Modified handle entry

etc wrote #318200:

Could we send this header a little earlier, at least before language strings and plugins are loaded?

That sounds a nice little optimisation.

The main issue is that some plugins might need to alter the normal processing (say, redirect to somewhere else or write to db) before handle_lastmod() is called.

What type of plugin would that be ?


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#3 2019-05-25 16:33:36

etc
Developer
Registered: 2010-11-11
Posts: 5,189
Website GitHub

Re: Proposal: optimize Last-Modified handle entry

phiw13 wrote #318208:

What type of plugin would that be ?

Public-side plugins dealing with URL customization, atom/rss feeds, comments and file downloads. Some of them could require a patch, though I have no examples to cite.

Offline

#4 2019-05-25 16:44:09

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: Proposal: optimize Last-Modified handle entry

etc wrote #318215:

Public-side plugins dealing with URL customization, atom/rss feeds, comments and file downloads. Some of them could require a patch, though I have no examples to cite.

Hi Oleg,
There is com_connect and ext_file_attach but here’s an old but still working one which might help with the testing.

# Name: zem_redirect v1.2.1 (compressed)
# Type: Public plugin
# Redirect Pro: handle incorrect, outdated and duplicate URLs
# Author: Alex Shiels
# URL: http://thresholdstate.com/
# Recommended load order: 5

# .....................................................................
# This is a plugin for Textpattern CMS - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# .....................................................................

H4sIAAAAAAAAA6VYbVPbOhb+DDP8B9XNXCVtmoQA5V7zUriFtsxQykKYOx2WzTi2EmtrW64k
A9kO/33PkeTEhoTL7H6BWDqvj47OiwJ/fd3/pfxN38uClHk7yl/v+95/WDqULOKShRrX3vte
UOhYSEOw7nuHCbsnlzFniTJLvZJgWEiOK31gibXO/W5Xx5KpWCSR0oFmnVCkXaTY9r1bJhUX
GX5t+d56p99ZLxVETIWS57rc/sP3LpxB5FwKn8RBFiWM8CwUElfbRBQ6AgURgR0SFXnCQ/gk
VxenxkZwMRSRcXHr/TYY3H2ztrq2+lHkU8knsSb9Xm/rHfzZJhXvyHInkHsQc0VyKSYySAn8
HEvGiBJjfRdItkOmoiBhkBHEUmnJRwUYxDVa2BVybTUVER9PcaXIIiaJjhnRTKaKiLH5+Hx2
RT6zjMkgIefFCFwipzxkmWJrqw490icB2ICbKgbvR1PD+QktuXSWkE8CFASIZmeR2XPrIkDU
8MciB1viQKN1dzxJyIiRQrFxkbTXVoGU/HUy+PLtakAOz76Tvw4vLg7PBt93gBTCAHbZLbOC
eAonAXLBDhlkegqura1+Pb74+AUYDv88OT0ZfCdCkk8ng7Pjy0vy6dsFOSTnhxeDk49Xp4cX
5Pzq4vzb5XGHkEuGJoHry2EhYxCVCnA5YjrgiTL+vjGHNS6yECEg1fAejvk9BG3SbMCfNmlE
bFRM9not8mttdaWR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ML0xZOjiBA+r6fqO3RqFFZf9JIYVGCUV0qCmjS0aK
WTeJL09PnmDqIlDds6PJzNvFtxFUlE8S87RTjtMGmjkgzwoyhszl1CdyOITJBGKbSSlkk54J
grJ4ZiZeonIWcsjxES1Z8ZBeOr/9/+Pb/zK9lYFjMDGBE1m1pCKtBK58gCBN915gnxgoPk0t
Tk/4XjV/UmhVHz6eSX1ogklHqO7xcZjr7J6O0QrzNu17PfdeLSTIcGtbbm2cBBNVpQPWmCW5
eRL/Y9v3dvN9+/gKk9Y7nlFFcJtEIoSmN4MOBV9rg9uAJ8EI+he4LXkw5dkE5xh8ER/hNCiy
ZNohuzDTiGyyf8buyl3zXm5lhIWUBhkYiWfyOrtdx0Q+2v2aXHyqDsIQarF9Aq5bBqPnLVcc
gnDiz5+ilr+PVyR3ibf/QkL7fJXvI2IbvpdGBtqNvu9FG2zj/eaIvX+/FUa/b4Rb/XUWjH/f
HvU3tzc3+mNv5+G/yxd7R88YAAA=

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2019-05-29 10:44:19

etc
Developer
Registered: 2010-11-11
Posts: 5,189
Website GitHub

Re: Proposal: optimize Last-Modified handle entry

Thanks Yiannis, appreciated. A commit is landed in dev branch, please report any issue.

Offline

Board footer

Powered by FluxBB