Symfony2: the world slowest framework

34
Symfony2 The world slowest framework venerdì 18 ottobre 13

description

I benchmark effettuati su molti framework PHP negli ultimi mesi mostrano una netta inferiorità di Symfony2 rispetto agli altri. In questo talk parleremo del perchè i benchmark sulla velocità non rappresentano il vero valore di Symfony2, mentre lo sono la flessibiità, la modularità e l'aderenza a degli standard. Parleremo delle caratteristiche che rendono questo framework uno dei più usati in ambito PHP, anche solo considerando quanti altri framework stanno integrando parti di esso. Infine, parleremo di come questo framework metta nelle mani di chi lo utilizza strumenti molto potenti (e a volte complessi) e lasci la responsabilità di come utilizzarli a noi sviluppatori. In questo momento vale come mai prima la massima 'da grande potere deriva grande responsabilità'.

Transcript of Symfony2: the world slowest framework

Page 1: Symfony2: the world slowest framework

Symfony2The world slowest framework

venerdì 18 ottobre 13

Page 2: Symfony2: the world slowest framework

What’s a framework?

[...] a software framework is an abstraction in which software providing generic functionality can be

selectively changed by additional user-written code, thus providing application-specific software.

http://en.wikipedia.org/wiki/Software_framework

venerdì 18 ottobre 13

Page 3: Symfony2: the world slowest framework

FrameworkVS

Library

Inversion of Control

venerdì 18 ottobre 13

Page 4: Symfony2: the world slowest framework

Framework

ValueAND

Technical debt

venerdì 18 ottobre 13

Page 5: Symfony2: the world slowest framework

Speed

venerdì 18 ottobre 13

Page 6: Symfony2: the world slowest framework

Procedural VS OO Code

venerdì 18 ottobre 13

Page 7: Symfony2: the world slowest framework

Procedural VS OO Code

venerdì 18 ottobre 13

Page 8: Symfony2: the world slowest framework

Optimization

venerdì 18 ottobre 13

Page 9: Symfony2: the world slowest framework

Server VS Dev Costs

venerdì 18 ottobre 13

Page 10: Symfony2: the world slowest framework

Freedom to change

venerdì 18 ottobre 13

Page 11: Symfony2: the world slowest framework

What do you need?

venerdì 18 ottobre 13

Page 12: Symfony2: the world slowest framework

What do you like?

venerdì 18 ottobre 13

Page 13: Symfony2: the world slowest framework

Knowledge

venerdì 18 ottobre 13

Page 14: Symfony2: the world slowest framework

Community

venerdì 18 ottobre 13

Page 15: Symfony2: the world slowest framework

Steep learning curve

Symfony: beware of

venerdì 18 ottobre 13

Page 16: Symfony2: the world slowest framework

Symfony: beware of

from great powercomes great responsability

venerdì 18 ottobre 13

Page 17: Symfony2: the world slowest framework

Community

Why I choose Symfony

venerdì 18 ottobre 13

Page 18: Symfony2: the world slowest framework

Why I choose Symfony

Adhere to standards

venerdì 18 ottobre 13

Page 19: Symfony2: the world slowest framework

Frameworks are developers tools

Why I choose Symfony

venerdì 18 ottobre 13

Page 20: Symfony2: the world slowest framework

No need for the full package

[thanks composer!]

Why I choose Symfony

venerdì 18 ottobre 13

Page 21: Symfony2: the world slowest framework

Based on HTTP

[request/response, caching, reverse proxy, esi]

Why I choose Symfony

venerdì 18 ottobre 13

Page 22: Symfony2: the world slowest framework

To Production

php app/check.php

venerdì 18 ottobre 13

Page 23: Symfony2: the world slowest framework

AppCache.php is your friend

To Production

venerdì 18 ottobre 13

Page 24: Symfony2: the world slowest framework

Doctrine

query_cache_drivermetadata_cache_driver

result_cache_driver

APC - Memcache - XCache - Redis

To Production

venerdì 18 ottobre 13

Page 25: Symfony2: the world slowest framework

Profiler

No, thanks.

Always add ‘--env=prod’ to command

To Production

venerdì 18 ottobre 13

Page 26: Symfony2: the world slowest framework

Logging

Only errors, thanks.

To Production

Monolog ‘buer_size’ parameter

venerdì 18 ottobre 13

Page 27: Symfony2: the world slowest framework

Apache routes

php app/console router:dump-apache -e=prod --no-debug

To Production

venerdì 18 ottobre 13

Page 28: Symfony2: the world slowest framework

Assetic

php app/console assetic:dump --env=prod --no-debug

To Production

venerdì 18 ottobre 13

Page 29: Symfony2: the world slowest framework

Composer

php composer.phar install --optimize-autoloader

To Production

venerdì 18 ottobre 13

Page 30: Symfony2: the world slowest framework

PHP < 5.5 => APC

PHP >= 5.5 => OPCache

To Production

venerdì 18 ottobre 13

Page 31: Symfony2: the world slowest framework

3. Premature optimization is the route of all evil

My Conclusion

2. Readability matters

1. Choose on your needs

venerdì 18 ottobre 13

Page 32: Symfony2: the world slowest framework

Thanks

Filippo De Santis

@filippodesantis

[email protected]

venerdì 18 ottobre 13

Page 33: Symfony2: the world slowest framework

http://slides.seld.be/?file=2011-10-20+High+Performance+Websites+with+Symfony2.html#1

http://www.gregfreeman.org/2013/your-php-framework-choice-doesnt-matter/

https://igor.io/2013/09/02/how-heavy-is-silex.html

http://stackoverflow.com/questions/16696763/why-is-symfony2-performing-so-bad-in-benchmarks-and-does-it-matter

http://symfony2-checklist.com/

http://slides.liip.ch/static/2012-05-18_symfony-speed.html#1

http://www.slideshare.net/liuggio/rationally-boost-your-symfony2-application-with-caching-tips-and-monitoring

http://www.nigeldunn.com/2011/11/24/my-last-thoughts-on-symfony2/

http://docs.doctrine-project.org/en/latest/reference/caching.html

http://symfony.com/doc/current/index.html

http://www.emanueleminotto.it/im-afraid-symfony-2-performances

http://www.slideshare.net/liuggio/rationally-boost-your-symfony2-application-with-caching-tips-and-monitoring

Refs

venerdì 18 ottobre 13