Serverless in PHP: an interview at the PUG Milano

Aurélien Lair
TUI MM Engineering Center
4 min readJun 17, 2020

--

Milan is a city that brings together many talents and offers a great opportunity to discuss technological innovation. Musement is a very active company in terms of organizing technological events such as the PHP User Group. Musement hosted the PUG Milan last January 29 and on this occasion we covered a very hot topic in the community, Serverless in AWS environment, which we will describe through the eyes of its speaker Gianfranco Castro, CTO at Tecniche Nuove.

Hi Gianfranco, can you tell us a little about yourself?
Always passionate about computer science, I started writing code in middle school. I love technology, programming and I deeply believe in personal Continuous Learning and Improvement, a necessity for working in IT. Having the opportunity to be a teacher of various IT courses, I have always paid attention to how students perceive development, listening to their observations, implementing mutual enrichment. Currently my stacks are based on AWS, Docker, PHP, Python, NodeJs and everything that complements these technologies

The PHP User Group Milan (PUG) was born as part of the Grusp community or the association of PHP User Groups and Developers in 2012. It organizes events and conferences throughout Italy, using professionals at national and international level, and is managed by a community of non-profit organizers with the aim of stimulating the community to develop better software and feed the passion of the participants by accompanying them on their professional growth.

How did you find yourself as a speaker at our PUG?
For several years I have known PUG and for a long time I have only participated in the meetings without contributing significantly. Only in the last three years I have proposed myself for talks. I enjoyed the experience, where I felt a real spirit of cordiality and sharing of knowledge. In addition, I consider the PUG a point of reference for getting up-to-date news, networking, and comparing yourself with other developers. I also recognize in the PUG the freedom to be able to deal with topics, being able to express myself better. In fact, I will come to propose other talks.

Getting to the point, what did you like about Bref and what didn’t you like?
Bref allowed me to solve scalability problems on internal e-commerce tasks and applications, having the possibility to recycle PHP code that has already been well tested. It is not suitable for all contexts and must be carefully evaluated, as it could overlap with something simpler or more performing (see node). Its strength is the ability to adapt to existing PHP applications, while one aspect which, in my opinion, still needs work is the “ready-to-use” integration with respect to frameworks such as Laravel and Symfony.

What are the limitations to consider when using Bref?
They are the same as in a Serverless application, that is, in reference to AWS, it is necessary to abstract the filesystem on S3, manage the logs on Cloud Watch, and manage the cache for example on an instance of Redis.

When do you think you should NOT use a solution with Bref?
In my opinion, it makes no sense to use Bref in a website provision context, where there are other solutions; in the case of usage with Symfony and considering its coldstart, it may not be an optimal solution, but it should always be considered based on what the application does.

Considering the coldstart times, would you use Bref to launch Symfony console commands?
Considering that from October 2018, the maximum execution time of a lambda is 15 minutes (compared to 5 of the previous one), it can be considered to execute console commands with Bref, also taking into account the coldstart times. Maybe in this case I would use PHP7.4 to take advantage of its preloading mechanism.

In your talk you brought us the example of your company where you had to manage punctual traffic peaks. Do you think the solution can also be useful for those with almost constant traffic?
In the case of constant traffic or occasional processing peaks of (so I don’t have a concern for performance), the choice of Serverless, in my opinion, could be guided by an economic opportunity, to choose what costs me less, Serverless or other solutions. There are several cost calculators out there: doing the math can be the driver on this decision.

Would you overall recommend using PHP with Serverless in companies?
About this there is no “magic recipe” that works for everything; by breaking down the question I would recommend the use of Serverless in companies, as there are scenarios in which it brings simplification and immediate implementation. I recommend the use of PHP with Serverless, where I need to make my medium complexity PHP application scalable. I do not recommend the use of PHP on Serverless for the execution of particularly complex applications that require a lot of resources.

--

--