BFD Calendar Posted March 27, 2019 Share Posted March 27, 2019 I'm experiencing annoying slowness on www.mekano.info. Pingdom.com tells me it takes 74.7ms to load the http and then 5481.6ms to load the https. I have the impression it's been better before. We use the website a lot to manage our tool lendout system and lasertime with Form Builder and selling materials with Padloper, so we roughly add 100 pages a day. 5 clicks for a Padloper sale (add to basket -> checkout -> confirm -> verify & add -> back to list) add up to a lot of waiting.... Anybody who can direct me to the culprit? Using PW 3.0.98 PHP 7.1 Link to comment Share on other sites More sharing options...
wbmnfktr Posted March 27, 2019 Share Posted March 27, 2019 First things first... Why do you load this whole set of module stuff on every page? As far as I can see there is no need for that. As part of this your average page size is ~1.2MB which is way too much for whats happening on the pages. At first I thought you were facing a hosting issue here but static files are loading fast so I guess your querying a lot of data on each and every page load and don't use any caching where possible. 1 Link to comment Share on other sites More sharing options...
dragan Posted March 27, 2019 Share Posted March 27, 2019 A performance audit with Google Chrome (Lighthouse) delivers abysmal results. TTFB over 6 seconds. This has nothing to do with frontend assets. You must be doing something terribly inefficient in your code (PHP)... You should use Tracy Debugger and see what's causing all this slowness. Also take a look at your server logs. Does a local copy of the same site load equally slow? Did your hoster change any PHP/Apache settings recently? 2 Link to comment Share on other sites More sharing options...
BFD Calendar Posted March 27, 2019 Author Share Posted March 27, 2019 @wbmnfktr Well maybe I don't need all the script stuff on every page, but I do on the pages we use most. And probably some stuff added up over the years and might be obsolete, but hard for me to decide. @dragan Maybe too much is cramped on one page as I want a lot of information at the same time. Out of a list of over 1800 students what they've borrowed and when, when they used a lasercutter and for how long, if they attended a lasercutting workshop, got a pair of safety glasses, etc. And then there's three forms on one 'student' page, each adding the name automatically, the time and with just one click when they start using a laser or borrow a tool. So I could clean up the header part for some pages, but then still have to wait on the pages we use most. Or create more different pages for different purposes, making it more difficult for my staff to find what's where.... I have Tracy Debugger on but don't really know at first sight where to find the slowness causes. Link to comment Share on other sites More sharing options...
dragan Posted March 27, 2019 Share Posted March 27, 2019 7 minutes ago, BFD Calendar said: Maybe too much is cramped on one page as I want a lot of information at the same time. Out of a list of over 1800 students Care to explain? Do you load infos about all that on every page load? "just in case you need parts of it somewhere"? What's in you _init.php of _func.php, or whatever you use before the main template file(s)? If you indeed query 1800 pages (and several fields, relations etc.) then no wonder it's not fast. Did you build the site yourself, or did you take it over from someone else? Also, I have never seen an HTTP header like this: x-iplb-instance: 28111 Any idea what this is? Link to comment Share on other sites More sharing options...
dragan Posted March 27, 2019 Share Posted March 27, 2019 Also, nothing happens when I add something to the cart. Are you sure it's working at all? I see no visual feedback, and after going to another page, I see no cart anywhere. Link to comment Share on other sites More sharing options...
wbmnfktr Posted March 27, 2019 Share Posted March 27, 2019 20 minutes ago, dragan said: when I add something to the cart Wow... it took me a while to find that cart button. 42 minutes ago, BFD Calendar said: there's three forms on one 'student' page So... the real magic happens on pages that aren't visible to non-students? 42 minutes ago, BFD Calendar said: list of over 1800 students what they've borrowed As you know who still has something to return you maybe could limit your query to only those students. And maybe it's not even necessary to have those details in real-time quality. Maybe cached pages (hour or day) is enough. Link to comment Share on other sites More sharing options...
BFD Calendar Posted March 27, 2019 Author Share Posted March 27, 2019 @dragan Nothing happens when you add something to the cart because only admins can operate the shop. We sell stuff at a counter and students pay right away. I can give you a working login if you want. I made the site myself with bits and pieces, starting from the basic multi-language sample. Since 2015 adding and replacing and removing several modules, maybe leaving debris. And on a few occasions I had PW users here solve problems beyond my limited capacities. _init and _func are virtually unchanged from standard values. And I have no idea where this x-iplb-instance comes from, don't have it in my header or template.... x-iplb-instance: 28111 Link to comment Share on other sites More sharing options...
dragan Posted March 27, 2019 Share Posted March 27, 2019 14 minutes ago, BFD Calendar said: I can give you a working login if you want. Sure; you can PM me, and I'll have a look Link to comment Share on other sites More sharing options...
BFD Calendar Posted March 27, 2019 Author Share Posted March 27, 2019 16 minutes ago, wbmnfktr said: So... the real magic happens on pages that aren't visible to non-students? 1 hour ago, BFD Calendar said: True, students can only see some results of what happens. On the calendar page they can see if a laser machine is busy and the last 10 entries of users (I had 15 users today and it's a rather quiet day). On the lendout page they can see the tools that aren't back. As admin we can see the list with links to the pages, where we can mark the tool as returned and make is disappear from the list. The template for the lendout page looks like this: <?php namespace ProcessWire; // LENDOUT LIST TEMPLATE include("mekano_header.php"); ?> <div id='main'> <!-- main content --> <div id='content'> <span class='verdana_18_black_bold'><?php echo $page->summary; ?> <hr> <?php header( "refresh:600;" ); $features = $pages->find("template=lendout, return_time='', sort=-lendout_time"); echo "<div class='verdana'><ul>"; foreach($features as $feature) { // STUDENT $studentspages = $pages->find("template=students, id=$feature->student_name"); foreach($studentspages as $studentspage) { }; // RESULT ADMIN if($user->isLoggedin()) { echo "<li> <a href='{$feature->url}'><span class='verdana'>{$feature->lendout_time} -> {$studentspage->title} "; // LIST OF TOOLS LENDED $toolspages = $pages->find("template=tools, id=$feature->tool, sort=title"); foreach($toolspages as $toolspage) { echo "<style> ul#menu li { display:inline; } </style> <ul id='menu'><font color='green'><li>| {$toolspage->title}</span></li></font></ul>"; }; if($feature->lendout_notes) { echo "<ul><font color='green'><li>{$feature->lendout_notes}</li></font></ul>"; }; echo "</li></a>"; } // RESULT STUDENT else { echo "<li> <span class='verdana'>{$feature->lendout_time} -> {$studentspage->title}</span> "; // }; // LIST OF TOOLS LENDED $toolspages = $pages->find("template=tools, id=$feature->tool, sort=title"); foreach($toolspages as $toolspage) { echo "<style> ul#menu li { display:inline; } </style> <ul id='menu'><font color='red'><li>| {$toolspage->title}</span></li></font></ul>"; }; echo "</li>"; }; }; echo "</ul></div>"; // NEW FORM if($user->isLoggedin()) { echo "<hr>New"; echo $forms->embed('tool-lendout'); } ?> </div> <?php include("mekano_footer.php"); ?> So you have an idea how some pages work behind the curtains. Link to comment Share on other sites More sharing options...
wbmnfktr Posted March 27, 2019 Share Posted March 27, 2019 What's happening in your lendout template right after // STUDENT? There is an empty foreach() loop in your snippet. Is that correct? Link to comment Share on other sites More sharing options...
BFD Calendar Posted March 27, 2019 Author Share Posted March 27, 2019 @wbmnfktr after // STUDENT the student's name is found from the id that was filled in on the lendout-form (page-field select). Then the list of tools this student borrowed are found from the id(s) that was filled in on the lendout-form (page-field check boxes). Lendout time is filled in automatically when the form is published. Return time is filled in by editing the form/page with a script by @Soma. If you want I can give you a login to have a better idea how things work. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now