International PHP Conference in Munich 2015
The International PHP Conference 2015 in Munich was a great event for me. Many useful talks around PHP and web development and I was an attendee of the PHP: Continuously Delivered workshop by Sebastian Bergmann and Arne Blankerts. There were also interesting thoughts about PHP 7 and the strict type mode at the IPC Open Night - The Road to PHP 7 discussion. In this blog post, I will share some notes of some talks I have visited.
Docker in production
The Docker in Production talk by Rober Lemke was very interesting for me. Since Docker 1.9 has been released, maybe there is no need for Google's Kubernetes anymore. I highly encourage you to checkout the new Docker features like Multi-Host Networking and persistent storages.
Here are my notes for this talk:
- The RancherOS system is based on Docker and there is User-Space based on Docker
- CoreOS runs Docker natively, no package manager is needed
- Use own images for production, which are based on phusion/baseimage (Ubuntu, Docker optimized)
- Deploy your source code with the Docker image
- Use HashiCorp Otto to have complete Infrastructure as Code
- Use a private Docker registry (Google Cloud)
- Use Jenkins to build your Docker images
- Save your data on Amazon S3
- Use
restart: always
in your docker-compose.yml definition to avoid interrupted containers - Immutable machines, Docker upgrade means create a new machine, don't upgrade the host system
- Use dashboards for monitoring like Datadog or Sensu
- PCI compliance is no problem, because you know the exact configuration of your webservers
Zend Framework
Ralf Eggert talks about his new shiny development tool ZF2Rapid in his talk Zend-Framework-Anwendungen im Handumdrehen and about Zend Framework 3 – Reloaded. ZF2Rapid creates really fast a ZF2 application and is very useful for prototyping. It's also useful to generate some files for a task (Controller, Models, Views, Configuration).
There is no need to say that ZF3 is blazing fast and more interoperable than ZF2. The Service Manager component is 4x faster and the Event Manager component is 4x - 15x faster than the ZF2 implementation. Also the documentation and migration guides has been improved. No more framework silos in your code. Decouple your code from the framework!
nginx tricks for PHP Developers
The talk nginx tricks for PHP Developers by Ilia Alshanetsky gives some insights how to configure nginx properly. The slides contains very useful nginx configuration settings and gives hints to optimize your nginx server. SSL settings like OCSP stapling are explained to get an A score on ssllabs.com. Logging, caching and rewirte rules advices completes the slides.
Here are my notes for this talk:
- Use a backup server in another region
- Use always $request_uri (security HTTPs redirects)
- Use return instead rewrite (faster)
- Check ssl_ciphers list
- Check gzip compression performance hints
- Use pre compressed gzip files and generate these files on deployment
- Use nginx cache instead of eTags
- Use the access log buffer (performance)
PHP profiler performance
I've written a comparison of PHP profiler and it was very interesting to hear Benjamin Eberlei's insights in his talk Was man über PHP-Performance lernt, wenn man einen Profiler baut. The Xdebug profiler and others, maybe not the right choice to analyze the performance, because of the overhead of the profiler itself. So you can run into a trap and optimize the wrong function, especially when you use PHP7.
Here are my notes for this talk:
- PHP7 has moved some function to the Opcode Cache (e.g. count, strlen)
- PHP profiler bloat native functions (e.g. is_array)
- Measurements with Xdebug are slow because of the used time function
gettimeofday
- Don't install Xdebug on production server! It's slow, also when you have disabled Xdebug.
- Function calls in PHP5 are expensive (linear)
- Macro-Optimizations are efficiently than code optimizations (use current PHP version, use Opcache)
- If Opcache has no memory to store new data, old data will not be deleted. Delete the whole cache on deployment! If you use symlinks you should also call
clearstatcache()
to avoid errors if you switch to a new version. - PHP7 has an option to save the Opcache on filesystem, tune Opcache with max_wasted_percentage
- Keep in mind session blocking on ajax requests, use sessoin_write_close() early
- Profiling locally is only useful in some cases, because you don't have the exact environment (hardware, influences)
- Think about architectural changes, factor > 10 (Elasticsearch, Varnish)
Innovation/Hack week
Johann Böhler and Michael Müller talks about "Innovation Week" in their company. Learning new things will never stop as a developer and companies often does to little to increase the developer knowledge. Developers need more space to explore new technologies and to understand design patterns and approaches better. I've learned many things from Zend Framework and the PHP community.
Here are my notes for this talk:
- Campus: 1/2 hour per week (Introducing new topics e.g. DDD, Event Sourcing, CQRS)
- Bookclub: 1 hours per week (Introducing books)
- Labs: 4 hours per week (free choice what to explore)
- DevDay: 8h per quarter
- 1/8 of time per week for innovation and further education
- 1 week per year for new ideas or projects
Conclusion
This were some impressions of the IPC 2015 in Munich. I hope you have enjoyed this blog post and are motivated to join some conferences. It was a really great event with awesome speakers and catering. I enjoyed the talks and the people there. I also want to thank thePHP.cc for the blue PHP elephant.