Symfony

Performance & Optimization

Profiler, Blackfire, query optimization, lazy loading, eager loading, caching strategies

22 interview questionsยท
Senior
1

What is the main purpose of the Symfony Profiler in the development cycle?

Answer

The Symfony Profiler is a debugging tool that collects detailed information about each HTTP request: execution time, SQL queries, memory usage, cache, events and more. It helps identify bottlenecks and analyze application behavior without modifying code. Unlike traditional logs, it provides an interactive graphical interface accessible via the Web Debug Toolbar.

2

How does Blackfire differ from Symfony Profiler for performance analysis?

Answer

Blackfire is a PHP application profiler that performs deep code analysis at the function-by-function level, with call graphs, profile comparisons and regression detection. Unlike Symfony Profiler which gives a per-request overview, Blackfire traces complete code execution with CPU, memory and I/O metrics at each function call. It also enables comparing performance between different code versions.

3

What is the difference between lazy loading and eager loading in Doctrine ORM?

Answer

Lazy loading loads relationships only when they are actually accessed in code, reducing initial load but potentially creating the N+1 problem with multiple additional queries. Eager loading loads relationships immediately with the main query via JOIN, avoiding extra queries but potentially increasing the amount of data transferred. The choice depends on how the data will be used.

4

How to identify and solve the N+1 queries problem with Doctrine?

5

What caching strategy to use for data that rarely changes but is read frequently?

+19 interview questions

Master Symfony for your next interview

Access all questions, flashcards, technical tests, code review exercises and interview simulators.

Start for free