Rails 3 development site is 10x faster than production site on Apache 2 + Phusion Passenger - ruby-on-rails-3

I have a live production site (production mode) running alongside a test site running in development mode. They both run on the same machine, using Rails 3, Apache 2 and Phusion Passenger. If I load the same page on the production site, it takes approximately 4-5 seconds to load the page. If I request the same page on the test site it takes (only) about 0.5 seconds. A major difference of 10x. Always thought that production would be faster than development :( If I reload the page on the production site the load times stay the same. What is going on? How can I debug this problem? Because as of now the production site is way too slow even without any traffic.
I did some additional testing with other web servers, in particular Litespeed and even Webbrick. Both exhibit the same strange behaviour. Ten time slower in production mode than in development mode. So it probably is something Rails related. But I can not put my finger on it. Since the logs tell me the pages are rendered quickly, but it takes a hell of a lot of time before the page appears on my screen.

Thanks for the suggestions guys. I managed to get it fixed. I finally decided to load all my production data to my development server. It turned out that my sessions table was the culprit. It contained a lot of data and querying was slow. I added an index and the problem was solved.

Related

Magento 2 Enterprise Multistore - Speed Optimization

Recently I have completed migration from M1 to M2. Total of 5 stores reside under single Magento 2 installation in the Cloud now. Page speed is a pain point at this time. Lighthouse and web.dev scans suggesting several areas to be improved, such as bundling JS and reducing JS execution time, as well as minimizing main-thread work. Installed Amasty Page Speed Optimization extension, but it barely made an impact. Installed Magepack JS Bundling tool, and it did make small difference, however still need to get the websites optimized to improve the performance. Can anyone suggest another extension or recommend effective steps to get the sites optimized?
It is difficult to say why your website is slow with limited information.
But you may try following.
Check if site is running in production mode.
All the caches are enabled.
Disable all the custom modules and check if it runs fast with default Magento code?
Try to enable Magento profiler and investigate which code/event etc. is taking more time.
Check Magento logs and Server logs to see if there are any errors or connection timeouts to any third party services.
Once you have some kind of report with which you can identify what is causing slowness. You may decide next course of action.

Xdebug boosts site speed

I have WAMP stack for development and a lot of sites are going slow, but I have a really big issue with PrestaShop because loading time is 1 min on average.
Although the content is loaded, the main request is responding very slowly and Chrome's waterfall shows that the delay is caused by Content Downloading, but all assets are already downloaded (local storage) or cached.
I noticed that when I enable the xdebug listener (on VSCode) the site is responding as it should, i.e. within miliseconds.
Any idea what might be happening ?

web pages stuck on "waiting for...", but then load fast

My website has a huge data base. Even this the frontpage with all content is 1.2MB. Small. I changed server because I wanted to load faster. In the old server when I clicked the url the site started to load serially, from the top to bottom. But in the new server I get the message "waiting for www..." in my browser down left for 4-5 sec and then my website displayed very quickly. When I remove one big mysql query, it is OK.
I downloaded the htaccess of boileplate, I put in Plesk hosting settings FastCGI application, but nothing.
Any idea?
If you are getting this issues due to mysql query then I will suggest you optimize your mysql services with MySQLTuner scripts. We have used that on for our some clients and it's working good. But make sure your mysql service up-time is more than 24 hours, so that you will get accurate suggestions in the script output.

Apache Crash Dialog

I'm running XAMPP on my windows machine and experiencing a problem with Apache crashing a couple times a day. When it does, a dialog pops up and I have to manually tell windows to end the program. After I do that, XAMPP automatically starts it back up in a couple of seconds with no issues. When it crashes while I'm not home though, the server is down until I get back. So I have two questions:
Are periodic crashes something that should be expected, or is this indicative of another issue I should be trying to pinpoint?
If this is something I should just learn to deal with, is there a way to automatically restart httpd.exe when these issues occur, so I don't experience down time when I'm away from home?
You'd look into log files, especially the Apache access and error logs, to see what happened, when you are not at home. I've met some similar situation: I have a problematic PHP script hosted on my server, when someone visits the page, it leads to an Apache crash.
I'd suggest you do the investigation as follows:
Search the timestamp of recent Apache restart.
Check the Apache access log to see whether there are some scripts have been accessed.
Manually access these scripts in your browser (to see if Apache will crash again)
You'd better check the PHP error log as well.
If there is really nothing suspicious, you can try WAMP bundle alternatively, which is also a very popular PHP development environment and it is stable.
Although there aren't many cases in which one should "expect" periodic crashes, in this case you are better of reconsidering your setup. From the frontpage of the XAMPP site:
XAMPP is the most popular PHP development environment
Sure, you can use it as "production" server, but XAMPP isn't build for hosting websites, it is intended as development server, so you don't have to manually setup Apache, PHP and MySQL on you dev machine. If you actually want to run your website for the public, setup Apache/IIS, MySQL and PHP manually, those products on there own are made for running in production. Or you can consider getting some cheap shared hosting somewhere, so you don't need to setup anything.

Visual Studio 2012 & IIS 7.5 running very slow on localhost

I am working on a project, the team (and vs2012) by default uses iis7.5 during development.
Very recently (yesterday) the sites I was debugging start loading very slow.
Using fiddler I could see that it would take about 30 seconds for every single call that is being made.
so "localhost:{port}" takes 30 seconds (2kb), once that finally comes back and the page starts to load it calls all the css and js files, each take about 30 seconds to load.
As this is a large application it quickly became unusable.
this happens whether I am debugging, or loading a page without debugging.
This same behavior happens an all sites on my dev machine, even plain newly build site exhibits the same behavior And occurs in all browsers.
I am able to "resolve" the problem several ways.
1. Switch from iis 7.5 to visual studio dev server.
(url does not change localhost:{port} to localhost:{port}.)
2. In web matrix, if I change the url from localhost:{port} to
http://{machinename}:{port} the site then runs faster (normal speed),
but debugging becomes and issue.
option 1 above does the trick and I dont seem to be effected too much by the change.
I am very curious as to why this is all of a sudden happening though, and would really like to fix the problem.
Any thoughts would be greatly appreciated.