Today we'll talk a little about Zend Server it was announced at ZendCon. A module for Zend Server is adding a bit of Magento specific profiling informations with Z-Ray. Right now i'm learning a lot of things so you should regularly have new tutorials...i'll translate my lasts 6 months articles of pierrefay.fr soon ! i promise ;)
Feel free to subscribe to the newsletter (on the right of this page) to receive a notice when there's a big event on this blog.
OK ok...now let's talk about the subject !
First present the Zend Server solution.
Zend Server is a web application server developed by Zend Technologies (PHP creators) in 2009. It is available on Windows, Mac, Linux .. To ULTRA simplify, it is a kind of apache but lot more powerful that contains an administration interface wich allows you to configure PHP, to deploy your application (or to manage your publications on staging / prod) more easily. It also seems that often gets better performance with Zend Server in Magento...check this because at the moment i have not enough experience with Zend Server to tell about that point :). If you have feedback on the subject of performances and ZendServer please share it with us by leaving a comment on the bottom of this page. i will be very interested!
We "magento developers", are interested by...? fo us here, that's Z-Ray! Zend has animated a conference on the subject at "Bargento 2014".
What is Z-Ray ?
Z-Ray is a toolbar that allows you to have a full vision of what happens when loading your page. Zend has placed earbuds in your php server (slightly like the CIA in your iphone ;) ) Which will allow you to have full information.
Take for example the homepage ! Basically when you load your homepage in magento, Z-ray will give you information such as time of loading of the server-side page, the number of SQL request (and will list all the request), the memory used for the loading of your page, timers for each block generation, etc....
ok ok a bit like Wee_Toolbar extension done?
yes it is exactly that! Except that it's like if you had in addition activated "xhprof" (Thanks to Olivier Garcia - @0livier - for telling me about this tool it a few months ago), which allows you to have more detail than the magento profiler on what's happening when redering my page... What function consumes what? how many times is it called ?
Ok ok but suddenly if I install the extension Liip_Xhprof of Fabian Vogler (thanks to him) theoretically i'll get the same ? So why must i install Z-Ray ?
Yes you are right I also told myself that at first ... (moreover it is the first message on twitter i've left about this topic ^^). Until I get this tweet this afternoon:
Ok...a Z-Ray extension for Magento
that allows me to easily analyze a magento website by giving me such indicators as xhprof but directly as "magento objects":
- Information on the loaded blocks: what class is used? where is the template?
- What events are triggered, what Observer is involved in this event, how much loading time consumes my event?
- What are the handles of my page?
- Details of the configuration
- Information from the request object
Well here it looks interesting ... essential tools and more lightweight comfort or downright useless? ... Let's go for the test!
Installing Zend Server
Installation is fairly simple, I just downloaded Zend Server from the website and i went to the directory where I downloaded it. Then i unzip the file (I'm on linux but it also works on Mac or Windows ... you just fit). I then go to the directory where i unzipped the file, i launch the installation script by specifying that I want it it to be installed with the version 5.4 of PHP and Zend Server will use an Apache server (you can also use Ngnix if you prefer).
tar xvf ZendServer-7.0.0-RepositoryInstaller-linux.tar.gz
./install_zs.sh 5.4 apache
The installation starts. It create everything you need and you can go to this address:
to finish the installation.
Here I have my installation panel, I filled the boxes and I put "next" ..nothing easier.
I select the "development" mode that will allow me to have an appropriate environment for a developer :
I defined my user, password, and I notice that it installs libraries for Symfony2, Zend Framework 1 and 2. Always helpful... even if for the time Magento is based on Zend Framework 1.
And my installation is already complete!
Then i go to 127.0.0.1:10081 and i arrive on the dashboard of my Zend Server!
Ok now I have Zend Server on, I want to install Magento so it will run on my server. I can start by creating a vhost.
Create Vhost for my Magento site in Zend Server Applications & gt; Virtual Hosts
and I click on " Add Virtual Host
" and then I fill the informations :
- Virtual Host Name: mymagento.lan
- Listen on port 80
- This virtual host Does not use SSL
- Use the default virtual host configuration template
I agree ... and finished! My vhost created! I see it appears in the list of my vhosts:
[Note]: It's like i have nothing to do, so that's already cool compared to a standard Apache installation...it's Super Easy (although it goes relatively quickly on Apache..Here is really great!)
You'll notice that the site is in orange and be asked to reboot the top left:
Once restarted, my vhost is green ... a sign that everything is OK!
As the domain name mymagento.lan
does not exist that's why i add the following line in my /etc/hosts
127.0.0.1 www.mymagento.lan mymagento.lan
And I go on mymagento.lan ... and ... It Works!
So now I install magento, the standard way ... I will not return to the Magento installation in this tutorial, but you can easily find documentation on this point on the Magento website.
So download the magento archive on www.magentocommerce.com/download/
then go to the folder where you saved it, unzipped him:
tar -xvf magento-22.214.171.124.tar.gz
Understand that in Zend Server, each website is an "application", it is just deployed and you can do it to infinity on different servers which makes deployments very easy between different versions of your site,... to facilitate Zend work, we will create a file "mymagento.zpk" which will contain the sources that will be deployed on the server and we will import it into Zend server to create our application.
Create Zend Package file (".zpk") for your Zend Server Application
Identify your file as a Zend application with the following command:
/usr/local/zend/bin/zdpack create mymagento magento/
you should have resulted in:
Skeleton files were generated into mymagento
Then move the contents of your magento folder in the directory mymagento/data/ newly created. It is this directory that will contain the files of our application.
Create and Zend Package (".zpk") with the following command:
/usr/local/zend/bin/zdpack pack mymagento
you should have resulted in:
scripts-dir is set to : mymagento/scripts
src-dir is set to : mymagento/data
package-descriptor is set to : mymagento/deployment.xml
Import the Zend Package file (".zpk") to create its Zend Server application
Then turn on the "applications" of your Zend Server administration interface and click Deploy Application
Click "Browse" and import your file (the .zpk created in the previous step). You should have this result:
Then choose the name of your application and vhost created in the previous steps:
Tick the acceptance of the license box, check the configuration of your system and complete the database information.
Then click deploy! Your Zend Server restarts and deploys the application.
After rebooting the server, your application now appears as "deployed":
You simply have to start installing magento ... "as usual";)
Also remember to install mysql server side:
sudo apt-get install mysql-server php5-mysql
and create your database:
mysql -u votreLogin -p
// Puis une fois connecté
> create database mymagento;
Z-Ray, the ultimate tool to help you solve your magento problems of performances
So actually, I have a small bar that appears at the bottom of my page:
That's all for now but I will continue my article soon ... For now what I remember is that the plugin Z-Ray for magento is best practice production in order to have identified a specific problem in real time and Zend Server is a killer for deployment ...a good discovery yet.
Pending further if you want to test the "magento" plugin go here !!
See you soon ...