Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-09-27 10:34:21

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Txp and Sql queries

Hi community,

Some questions regarding the Txp stats you can find at the bottom of every page generated by Txp…
Can you please tell me how you apreciate those Txp render stats for one page:

<code>
<!— Runtime: 1.3992 —>
<!— Query time: 0.049182 —>
<!— Queries: 37 —>
<!— Memory: 2925Kb, end of textpattern() —>
</code><br />

I assume queries and memory are describing Sql load… ? Right ?
Is that to be considered very high or just middle – acceptable values for a page…
Is there a reasonable common rule / range to keep those values into…
And finally do we multiply queries and memoy use per connection: if 100 visitors connect at the same time the memory load would be 100 × 2925 and queries would be 100 × 37

Cheese…

Last edited by hablablow (2006-09-27 10:35:20)


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#2 2006-09-27 10:55:15

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: Txp and Sql queries

I assume queries and memory are describing Sql load… ? Right ?

It depends on what you mean by “load”. The number of queries is the number of queries (hah!). There is a correlation to the load it puts on the database, but I wouldn’t overvalue it. It’s also possible to use fewer quries while putting a lot more stress on the database. In general though, you try to keep the number of queries lower (though not “at all costs”).

Acceptable number of queries depends entirely on the context. If the server is idle most of the time and you have low traffic, you can get away with hundreds of queries without ever noticing it. A stock Textpattern install has (IIRC) around 12 queries on the front-page. The more dynamic stuff you add, the more the number of queries will increase. You can use zem_cache to cache certain party of your templates for x minutes, if you know they don’t change often, and you want to lower the number of queries.

And finally do we multiply queries and memoy use per connection: if 100 visitors connect at the same time the memory load would be 100×2925 and queries would be 100×37

“at the same time” is a very vague measure. Usually the total runtime is well below one second. So even when 100 requests would come within the same second, they would not be all executing at the same time.

Given the architecture of PHP, yes, every request “is an island unto itself”, i.e., each request runs in it’s own context, and will do the queries and consume memory. If have concerns about this, you might want to look at full-page caches, like asy_jpcache (textpattern plugin), which will basically serve cached pages without connecting to the database at all and use less memory as well. If it is your own server, you can also look into installing opcode caches, like eaccelerator, xcache, apc, that will considerably lower excution time and memory usage.

Offline

#3 2006-09-27 11:06:36

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: Txp and Sql queries

Thanks Sencer much appreciated…
Someone should add an entry in the Textbook about this subject as Txp is firing those results when production status is set to testing, under publish preferences … At least to explain a few basic rules on how this works as you did nicely…

Last edited by hablablow (2006-09-27 11:07:20)


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#4 2006-09-27 13:44:45

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: Txp and Sql queries

asy jpcache is awesome… Thanks Sencer, already installed and working as a charm… I wonder why it has not been added to the plugin list in the Txp Ressources… And why not bundled whith Txp by default as a preference option…

Last edited by hablablow (2006-09-27 13:47:01)


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#5 2006-09-27 15:26:11

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: Txp and Sql queries

For those following this thread, installing asy jpcache, caching pages during 300 seconds, instead of requesting them from the Db each time a page is fired, and hardcoding my css files instead of managing them from inside Txp, from the style tab, makes my pages flying now at rocket speed… Wow ! Really amazing…


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#6 2006-09-27 18:57:34

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: Txp and Sql queries

We have an FAQ entry that has detailed information on the numbers and on performance related troubleshooting:
http://textpattern.com/faq/136/diagnosing-performance-problems

It is possible that you got “bitten” by slow DNS resolution for the logging (which can be turned off – the DNS lookup I mean). That part is by default skipped by asy_jpcache. Using a full page cache is a compromise, because of the many restrictions it enforces – and most people cannot feel any difference (the exception being, of course, if your pages are slow for some reason).

Offline

Board footer

Powered by FluxBB