简体   繁体   中英

How to log page generation time and number of MySQL queries for Silverstripe

We are working on a large Silverstripe website which has a large database (700,000+ rows on one table). There are issues with hosting performance which are hard to quantify so I'm looking for ways of measuring the page generation time and how many SQL queries are being used to generate each page.

For a past SS project I hacked the core code to record the pageload time in milliseconds, counting the number of SQL queries, and write to a CSV file.

However I'd really like to avoid changing the core code and was wondering if there are other options/ modules out there that do a similar thing.

Ideally I'd like a CSV which looks something like this Timestamp, URL, milliseconds, queries 2016/11/10 14:10:00, http://www.example.com/url1, 345, 67 2016/11/10 14:10:05, http://www.example.com/url2, 123, 45

There is also a debug toolbar for SilverStripe , we also mentioned it in our talk about debugging SilverStripe at the last StripeConEU.

You can install it to your require-dev section using composer:

composer require --dev lekoala/silverstripe-debugbar  

and of course flush after installation.

Then you see a small SilverStripe logo at the bottom left which hides the actual debug bar:

运行中的SilverStripe调试栏的屏幕截图

With this you can (beside much useful information) display all queries and also filter for duplicate queries only.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM