{"id":199,"date":"2011-04-08T14:51:34","date_gmt":"2011-04-08T19:51:34","guid":{"rendered":"http:\/\/xlinesoft.com\/blog\/?p=199"},"modified":"2013-06-04T11:58:23","modified_gmt":"2013-06-04T16:58:23","slug":"improving-perfomance-of-phprunnerasprunnerpro-applications","status":"publish","type":"post","link":"https:\/\/xlinesoft.com\/blog\/2011\/04\/08\/improving-perfomance-of-phprunnerasprunnerpro-applications\/","title":{"rendered":"Improving perfomance of PHPRunner\/ASPRunnerPro applications"},"content":{"rendered":"<h3>My application is slow. What do I do?<\/h3>\n<p>Usually \u201cMy application is slow\u201d means one or more list pages take a long time to load. Here are the things you can check in order to improve performance.<\/p>\n<h3>Is this issue server specific?<\/h3>\n<p>Test your application on at least two different servers i.e. on your local machine and on the remote web server. If you do not have a local web server upload your application to Demo Account to compare the performance.<\/p>\n<p>Just in case test your remote application from two different machines i.e. from work and from home. This will sort out any issues related to Internet connectivity.<br \/>\n<!--more--><\/p>\n<h3>Troubleshooting your application<\/h3>\n<p>If application works slow everywhere you need to find what exactly causes the trouble.<\/p>\n<p><strong>1.<\/strong> Turn off \u201cLoading \u2026\u201d box option on Miscellaneous page. While this won\u2019t improve your pages load speed it improves user experience allowing to see the data before the page is fully loaded. The trade-off is that some features like search panel or inline edit may not work until the page is fully loaded.<\/p>\n<p><strong>2.<\/strong> Reduce the number of records displayed per page. Display as many records as you can see on a single screen without scrolling. It improves user experience as well. If the users need to find a specific record they can use the search or loop through pages.<\/p>\n<p>If you absolutely have to display a large number of records on a single page make sure you turn off \u201cLoading \u2026\u201d box.<\/p>\n<p><strong>3.<\/strong> Reduce the number of fields visible on the list page. The golden rule is to fit all data on the screen without having to scroll either horizontally or vertically. You can display more detailed information for each record on the View page.<\/p>\n<p><strong>4. <\/strong>Use features like \u201cShow Add\/Edit\/View pages in popup\u201d and \u201cAJAX search, pagination and sorting\u201d. This makes your application more responsive and overall faster.<\/p>\n<p><strong>5.<\/strong> If you use search panel with lookup wizard controls this may slow down your application as well, especially if lookup tables are huge. The solution is to remove those fields from the search panel or use Lookup wizard type \u2018Edit box with AJAX popup\u2019. In this case no data will be pre-fetched on initial page load.<\/p>\n<p><strong>6.<\/strong> Turn on \u2018Case-sensitive search\u2019 option under Choose fields-&gt;Search settings. By default PHPRunner search is case-insensitive ( WHERE upper(LastName)=upper(\u2018Newton&#8217;) ) which is slower though more convenient for end users. Turning this feature on results in faster searches.<\/p>\n<h3>How to measure load speed<\/h3>\n<p>The best approach is to use Firefox with Firebug addon. Open Firebug, proceed to Net tab and reload your page. Firebug shows you what files are loaded, in which order, as well as each file size and load time.<\/p>\n<p><a href=\"http:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/04\/scr1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-200\" title=\"click to enlarge\" src=\"http:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/04\/scr1-1024x754.png\" alt=\"\" width=\"1024\" height=\"754\" srcset=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/04\/scr1-1024x754.png 1024w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/04\/scr1-300x221.png 300w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/04\/scr1-150x110.png 150w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/04\/scr1-400x294.png 400w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/04\/scr1.png 1129w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<p>PHP page (cars_list.php) is loaded first. Browser parses HTML code and loads images, Javascript and CSS files. On the screenshot above you can see that cars_list.php takes 546 milliseconds to load. 375 milliseconds (Waiting) is the server processing time while 171 milliseconds is the transfer time from the server to your computer. As a rule of thumb &#8211; if server processing time is under one second there is nothing to worry about.<\/p>\n<p>Another thing to keep eye on is the page size. If the size of the page is a few megabytes it will load quite slow. Also, make sure you are not using a search page with large lookup tables.<\/p>\n<p>Lets consider another example.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-201\" title=\"firebug\" src=\"http:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/04\/scr2.png\" alt=\"\" width=\"956\" height=\"930\" srcset=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/04\/scr2.png 956w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/04\/scr2-300x291.png 300w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/04\/scr2-150x145.png 150w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/04\/scr2-400x389.png 400w\" sizes=\"(max-width: 956px) 100vw, 956px\" \/><\/p>\n<p>You can see that server processing time is 36 seconds which is quite slow. Lets see what causes this.<\/p>\n<p>As a first step you need to find the SQL query PHPRunner executes. Slow SQL query execution is the number one reason of bad performance.<\/p>\n<h3>SQL Query<\/h3>\n<p>To print the SQL Query on the web page change $dDebug to True in the include\/appsettings.php file. Reload the list page to see the SQL Queries at the top of the page. In our case we are going to see something like this:<\/p>\n<pre lang=\"sql\">SELECT count(*) FROM votersall WHERE (1=1) and Residence_City='Zolfo Springs'\r\n\r\nSELECT County_Code, ... FROM votersall WHERE (1=1) AND Residence_City='Zolfo Springs' ORDER BY Residence_City DESC LIMIT 0,10<\/pre>\n<p>On the list page PHPRunner executes two queries. First query calculates the number of records that matches the current filter. Second one retrieves the data. Note limit 0,10 clause at the end. No matter how large your database is PHPRunner only retrieves as many records as required.<\/p>\n<p>If we execute those queries manually using phpMyAdmin or any other database tool we find that they in fact run slow (no wonder &#8211; our test database contains 12 million records). To speed up these queries we need to add indexes. Indexes are helping databases sort and find data faster. In this example we run a search for Residence_City field. Once we add an index on Residence_City field, our page takes less than a second to load.<\/p>\n<p>Here is how you can create an index (MySQL specific):<\/p>\n<pre lang=\"sql\">CREATE INDEX Residence_City ON votersall (Residence_City(20));<\/pre>\n<p>More info: <a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.0\/en\/create-index.html\" target=\"_blank\">Creating indexes in MySQL<\/a><\/p>\n<p><strong>Note:<\/strong> make sure to turn on \u2018Case-sensitive search\u2019 option when you use indexes.<\/p>\n<h3>What else I can do to increase the load speed?<\/h3>\n<p>Make sure your web host supports HTTP compression. HTTP Compression is a publicy defined way to compress content (mostly textual)\u00a0\u00a0\u00a0\u00a0\u00a0 transferred from Web servers across the world wide Web to browsers. The impact of compression is that the number of transmitted bytes is reduced and thus a higher performance is gained.<\/p>\n<p><a href=\"http:\/\/www.http-compression.com\/\" target=\"_blank\">More info on HTTP compression<\/a><\/p>\n<h3>ASP specific note<\/h3>\n<h4>Thread pool model: MTA vs STA<\/h4>\n<p>On some web servers all ASP pages generated by ASPRunnerPro load extremely slow.<\/p>\n<p>We found that switching the thread model on the application pool from <strong>MTA<\/strong> to <strong>STA<\/strong> resolved<br \/>\nthis problem. You will need to contact your web hosting provider in order to make this change.<\/p>\n<h4>Turn off IIS output caching<\/h4>\n<p>On some web servers output caching slows ASP application performance significantly. Try to turn output caching off to see if it fixes the issue. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>My application is slow. What do I do? Usually \u201cMy application is slow\u201d means one or more list pages take a long time to load. Here are the things you can check in order to improve performance. Is this issue server specific? Test your application on at least two different servers i.e. on your local machine and on the remote web server. If you do not have a local web server upload your application to Demo Account to compare the performance. Just in case test&#8230;<span class=\"clearfix clearfix-post\"><\/span><a href=\"https:\/\/xlinesoft.com\/blog\/2011\/04\/08\/improving-perfomance-of-phprunnerasprunnerpro-applications\/\" class=\"more-link\">Continue Reading <span class=\"screen-reader-text\">&#8220;Improving perfomance of PHPRunner\/ASPRunnerPro applications&#8221;<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,8],"tags":[],"_links":{"self":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/199"}],"collection":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/comments?post=199"}],"version-history":[{"count":13,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/199\/revisions"}],"predecessor-version":[{"id":840,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/199\/revisions\/840"}],"wp:attachment":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/media?parent=199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/categories?post=199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/tags?post=199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}