Subjects

All subjects Django Java Python React Spring Boot JavaScript PHP
Sign Up Free
PHP 10 questions

Performance Optimization & Caching

Optimize PHP application performance. Learn OPcache, Redis/Memcached integration, profiling, and efficient database query structures.

More PHP
Interview questions 1–10 of 10
1

What is OPcache and how does it improve PHP performance?

OPcache is a built-in PHP extension that stores precompiled script bytecode in shared memory, eliminating the...

Read answer →
2

What is the N+1 query problem and how do you fix it?

The N+1 problem occurs when fetching a list of records triggers one additional query per record to load relate...

Read answer →
3

What caching strategies are available in PHP applications?

Caching typeWhat it storesTool examplesOpcode cachingCompiled PHP bytecodeOPcacheData/object cachingQuery resu...

Read answer →
4

How do you use Redis or Memcached for caching in PHP?

Both are in-memory key-value stores used to cache data that's expensive to compute or fetch repeatedly, avoidi...

Read answer →
5

How do you optimize slow database queries in PHP applications?

TechniqueHow it helpsAdd indexes on frequently queried columnsAvoids full table scansSelect only needed column...

Read answer →
6

What is lazy loading vs eager loading and when should you use each?

ApproachBehaviorBest whenLazy loadingRelated data loaded only when accessedRelated data isn't always neededEag...

Read answer →
7

How do you profile a PHP application to find performance bottlenecks?

ToolPurposeXdebug profilerFunction-level call graphs and timingBlackfireProduction-safe profiling with visual...

Read answer →
8

How does autoloading with Composer affect PHP performance, and how do you optimize it?

Composer's default autoloader (PSR-4) resolves class names to file paths dynamically. In production, this can...

Read answer →
9

What is the difference between horizontal and vertical scaling for PHP applications?

Scaling typeHow it worksTrade-offsVertical scalingAdd more CPU/RAM to a single serverSimple but has a hardware...

Read answer →
10

What are common PHP coding practices that hurt performance, and how do you avoid them?

Anti-patternBetter approachQueries inside loopsBatch fetch before the loop / eager loadingLoading entire large...

Read answer →