Joomla on Azure Web App - performance issues - php

I'm trying to get Joomla running on Azure Web Apps but the performance is terrible. 3-5 second response time no matter what operation I'm doing.
Tried the Bitnami VM and it runs much much smoother, so the problem is obviously in the web app. Have tried both Cleardb and the internal mysql preview db and both give the same laggy result. It doesn't matter what sized machines I run on, they all lag.
The only thing I haven't tried is upgrading the Cleardb database from the free tier to the paid ones, simply because my subscription doesn't allow it. Since I see the same performance issue with the internal mysql db this should not matter.
My guess is that this is an issue with PHP and IIS. Anyone with similar experience, and possibly a solution?

Related

Slow queries between servers

Good morning to everybody, I would like to ask about a problem I have and which I'm not able to solve it.
I have two servers, one is the web server (it contains a large web application) and the other one is the BD server.
The problem is that both are virtualized in a physical server with VMWare and they were running correctly until two weeks ago. In the start of this month we noticed that the web application ran very slow and we started to investigate what was the problem. We have tried a lot of things and we do not know what is the problem and, of course, how to solve it.
Both servers has an internal IP and only web server is accessible from Internet. Only web server access to BD server in order to get the results of queries. It's true that web server and BD server has an older versions of PHP and MySQL respectively.
We did the following tests:
Analyze the consumption of both servers. They are in 1% of memory, swap and al types of consumptions. Our physicial server is new from a year ago and both virtual servers does not use more than 5% of their resources.
Reboot both servers
Reboot physical server (VMWare server)
Restore a backup from 1 and 2 months ago of both servers to discard code and BD data errors
Review code (we do not touch code from before the error)
We did some queries from terminal's webserver and they were fast. We looked for the BD log and we could see that queries have been doing one by one in a "slow" velocity (0,5s for query aprox, depending on the query it can be more than a second).
We suspect that PHP is doing something bad, but we do not touch the code and we do not update PHP version or MySQL version. We want to try to update MySQL version in a new virtual machine and migrate all the data there, but we think it will not solve the problem.
The connection between servers is perfect and we think that layer 2 should not be the problem. In the same webserver we have another web application (Moodle) that connects to this BD server too, and it does not have this problem...
What can be the problem? It's very strange this change of behaviour of the web application. We were on holidays on August and we returned and we found this problem.
For more information we use PHP 5.6.40 (webserver) and MySQL Ver 14.14 Distrib 5.1.60, readline 5.1 (BD server). (yes, we know they are old versions but the web application and BD are old too)
I hope someone can help us, we are a little bit lost.
Thanks for your help!
I'd try updating your servers for one, issues like these are commonly caused by older software.
I'd also start logging or looking into loads so you can determine whatever causes the slow speeds you're getting.

AWS RDS DB slow when deployed

I'm trying to implement a CMS on AWS using mostly free tier services and am doing so using PHP, and have already implemented this using PHPMyAdmin in school.
The problem:
I wanted to do this using RDS, but I've come up with a pretty strange issue.
When I upload my site to Elastic Beanstalk and try to connect to the DB from there, I face incredibly long wait times. Sometimes it returns error 504 from long wait times.
This is not an issue with the Database's speed, however. I know this because I can run this code on localhost and it works exactly as intended (see photo)
Only half a second to load!
What I think is happening:
Something must be going on while it's being executed in Elastic Beanstalk. I don't know quite what, but it's taking way too long.
Extra info:
I connect to the DB using the following code (credentials are spoofed):
$conn = mysqli_connect("mydb.cebelvm3fa0n.ca-central-1.rds.amazonaws.com","USERNAME","PASSWORD","mydb");
Both my database and EL instance are run from ca-central. The connection is not failing, it is taking an extreme amount of time.
the page that is failing is http://howardpearce.ca/posts.php
If you have any ideas on what it could be, I would appreciate it very much. Thanks!
NOTE:
I will post certain bits of my code, but creating an MCVE is really
not feasible as I would have to give my DB password, and you would
need to re-create my AWS environment, so please don't ask for one, I
can always give more detail.
After #colde mentioned checking logs, I quickly found an error code which lead me to the right resources.
My database was only configured to allow connections from my IP, and the firewall was blocking out my Elastic Beanstalk instance, I just had to add a new security rule.
Thanks!

How to set up a website with a PostgreSQL database?

I'm doing a group project and we're creating an online game. We're about half way done and now it's time to implement a database to store our records/data and make the website go live on the internet.
I'm just confused on how PSQL works exactly. My understanding is that PSQL needs to be running on some server in order to access it. For previous assignments, I downloaded Postgres for my Mac and ran it on localhost. The PHP code was something along the lines of:
$dbconn = pg_connect("host=localhost port=5432 dbname=mydbname");
So, if we intend to use PSQL, where would the server be? Do one of us have to host the server? Can we use some sort of free online server? How do we connect to that server with PHP?
In summary, I have two main questions:
How do we make our code go live on the internet for free? (It's just a temporary website and will only be up for a few weeks at most)
How can we all access a shared PSQL database?
Sorry for the noob questions, I just got started with web development and am still learning.
So, if we intend to use PSQL, where would the server be? Do one of us have to host the server? Can we use some sort of free online server? How do we connect to that server with PHP?
PostGreSQL is going to have to run on some machine visible to anyone who needs to access it. If only your web server (i.e., the machine running PHP and your website) needs to talk to the PGSQL, then PGSQL can be installed on your web server. This is a very common configuration.
The server might also run on the LAN where your web server is running or it might be running on an entirely different network on a different continent. The most important thing is that any machine which must connect directly to the database can actually connect to it. If you're building a website, this means you have a web server. Your web server will need to connect to the PGSQL server. The second most important thing is that your web server and the PGSQL server should share a very fast connection for the sake of performance and efficiency.
It's probably most common for your web server to also host the database. On an ubuntu machine, installing a PostGreSQL server is as easy as running a few commands. A quick search yields many examples like this one.
How do we make our code go live on the internet for free? (It's just a temporary website and will only be up for a few weeks at most)
I don't know anyone who is in the habit of offering free web hosting or DBMS services. You could ask a friend. Or put an ad on craigslist or something. Or if you are tech-savvy (it doesn't sound like you are) then you could configure a high-end router at your home to use Dynamic DNS to point some domain at a machine running at your house.
How can we all access a shared PSQL database?
I have no experience with Heroku, but you might sniff around there. PostGreSQL's website also maintains a list of hosting companies. Amazon offers RDS instances running PGSQL. Digital Ocean has a variety of tutorials and how-tos on dealing with PostGres. You could probably fire up a 'droplet' server for super cheap and install it yourself without too much effort.
Amazon offer a free tier database solution for Postgres. Something like 300 hours (don't quote me on it) for a low level set up.
They have tutorials on doing this here:
https://aws.amazon.com/rds/?nc2=h_m1
Once set up you get the end point and your connection string becomes something like
db_connect ("host=[URLENDPOING] user=postgres dbname=postres")

Azure website + mysql

I am starting my Azure Project. I did a website to Run Wordpress. Migrating from a previous host entity.
I use mysql, the ClearDb azure has is very limited and expensive $75 p month just because i need views and triggers ( only available on the dedicated server plan) its SAD. I Then created my MySql in Amazon RDS.
I did some latency tests, and the fact that Mysql being Closer to the Website region helps alot to reduce latency.
But still, my wordpress navigation seems slow! The first time is terrible, around 4 seconds. The next ones a bit better but nothing compared to my previous host of around 200ms!
Is this because of mysql being accessed by remote and not being in the same "data center" ? or is this because another thing like the "hot and cold" websites concept of Azure!? ( because even secondary calls are slow)...
I am starting to realize Azure is not Good for Websites with PHP + MYSQL.
I like the look and feel of Azure UI and Website concept but this is Very disappointing from azure not having a self MYSQL Structure.
Latency is a problem. Before assume that Azure is good or not, try a new thing. Create an azure virtual machine and install mysql in there. Then, edit your connection string to point to your VM. Also, install a plugin cache because wordpress execute a lot of queries in your database.
Another option: did you try the Scalable WordPress available through Azure Marketplace?
http://azure.microsoft.com/en-us/marketplace/partners/wordpress/scalablewordpress/
#Miguel, I agree with Thiago.
I think you can install MYSQL database on VM and connect it with your Wordpress website.
In this scenarios, I suggest you can use some tool to find the items which takes more times, such as webpagetest . It is useful for further steps.
At the same time, you can try to optimize your database,compress Images and so on. I recommend you can refer to this blog about how to improve the WP site performances.
By the way, Azure will unload your site if it is idle for the standard 20 minute timeout, which can cause slow responses for the initial site users after it is unloaded. You could enable the "always on" feature if you think it is necessary.
Did you try using persistent connections from your WordPress site to MySQL database. That can decrease latency times by decreasing time to create a connection and instead reuse existing connections.
The MySQL latency is an issue and there is probably not much we can do about it since the DB call has to be made further than to the localhost - simple as that.
1) If you need Azure for your MySQL driven eapp, use Microsoft's VM which is running quite reliably and where you can install PHP/MySQL on the same machine - speedy but relatively pricey. So far the only production acceptable solution for MySQL I found.
2) Don't use Azure if you need fast MySQL connections. We have tons of MS apps running in azure with various versions of MSSQL - and they all running relatively fine. So far I did not find fast solution for MySQL. Therefore, I am still using Linode for the PHP/MySQL apps. Their speed and service is superb (I am not getting anything from Linode for this recommendation :) and it is quite inexpensive in comparison to Azure in this case.

MongoDB connectivity with PHP dropping after idle time

I'm building a webapp with MongoDB/PHP, and everything's going great... except one thing.
My database connection is flaky. After X amount of time, when I refresh the page I get errors because queries are failing. I check mongod.exe and what I see is "Connection accepted from 127.0.0.1" - then I go back, refresh again, and everything's running all well and good.
What could be causing this? Database connectivity issues are something I never had to deal with in MySQL - but that's a whole different beast.
I would highly recommend you do your development with mongodb in a unix environment as they update the code the most often and you won't have to worry about strange bugs. Long ago i decided that doing dev in windows was much too inconvenient and moved my work environment to linux. If this sounds daunting, you might look into running a virtual machine with a local mount via samba such that you can run directly on a linux server on your local machine. Then you will have an environment similar to your production env. Hope this is helpful.

Categories