Symfony - General Thoughts

Hello everyone,

So, I’m starting on a new rather large project which needs to be capable of crazy fast performance (maybe not Google/Facebook crazy, but still pretty high spec).

Normally Wordpress is my go-to CMS of choice (don’t want to discuss that here =p), but it’s not going to cut it for this project.

I was thinking of building something from scratch, but in this day and age, that’s a bit silly.

I did some research and I’m thinking Symfony is going to be my best bet. I played around with some of it’s stuff. It’s a bit different (mainly the directory structure), but it seems like a pretty solid properly-namespaced MVC library. I think it’ll fulfill the needs of my project pretty well.

I just wanted to ask everyone that may have used Symfony for general thoughts. Are there any gotchas with it? Is it capable of really high performance (it’s caching engine seems pretty solid, so I’m hoping it is)? Anything else I should know?

Thanks.

I was under the impression Symfony was the largest framework and also the slowest.

Symfony is used by Yahaoo Bookmarks, Yahoo Answers, Delicious, Dailymotion… so yeah, Symfony can definitely perform. And I believe those sites I just mentioned were built with Symfony1. Symfony2 is relatively new and even better.

Overall, I think Symfony is extremely well architected. It’s a fantastic model for good OOP and design patterns. Usually you’d think with frameworks that you’re trading structure for flexibility, but Symfony never felt restrictive. It’s very configurable and flexible. You can use Twig for templates, or raw PHP if you prefer, or any other template engine of your choice. You can use Doctrine ORM, or Propel, or any other ORM, or no ORM. Symfony doesn’t lock you into anything.

Since you were thinking of building your own, then you may find From Flat PHP to Symfony2 an interesting read.

I already gave that a read. =)

I really like Twig and I haven’t used Doctrine before, but I’m liking what I’m reading.

I did a very simple test and it loaded my super simple dev page in 31ms. I’m assuming that’s probably cached (which this site would be largely dynamic), but still… that means that the overall overhead (when using cached content) is only 31ms… that’s pretty light-weight.

Can get even more speed by using a opcache as well.
And for high-performance applications I always recommend using one of the many cloud services.

I personally use Windows Azure, because well I like IIS7 but of course you are not limited to that.
It also forces you to build your application in such a way the allows high performance and reliability.

Thus I recommend this video if you want more information, it mainly covers Windows Azure but you can use it for others.
http://channel9.msdn.com/events/BUILD/BUILD2011/SAC-852F

And yes, PHP functions perfectly with Windows Azure. As does a lot of other services. Almost anything that runs on Windows Server will work.
Apache for example could be installed if you didn’t want to use IIS7.

I actually have opcode caching installed already (APC).

We use Rackspace Cloud for most of our hosting needs. We also have a pretty high end (though smaller) “cloud” in our colo.

Is Windows Azure a CDN-type cloud or is it pretty much like Rackspace Cloud (one server with stuff on it somewhere)? I personally don’t like IIS (or Windows as a server), but if it offered superior performance, I’d definitely be willing to look at it as an option.

Windows Azure is a PaaS (Platform as a Service), it offers a bunch of services including a CDN. Basically the hardware and the OS is all taken care of for you. You just worry about making your application stateless. Stateless so it can scale as the load increases or decreases. You are also never on one server. Even Storage is on its own server. But I do very much recommend you give it a look. Windows Server 2008 R2 (Which Windows Azure uses but highly modified) and IIS7 have both been improved greatly in terms of performance compared to older version like Server 2003 and IIS6. When properly configured with all the bells and whistles with opcache, and static/dynamic caching built into IIS7, PHP just flies.

But yeah thats from my own experience working and playing with PHP is various configurations and setups over the years.

Is the software on a CDN, or just some stuff. For example, Rackspace Cloud, the Cloud Servers are essentially a glorified VPN sitting in a data center in Texas. Their Cloud Files are on a CDN though, using Akamai.

I’ll give Windows Azure a really close look tomorrow. If the price is relatively in the same range and I think it’d suit us, I think it’d be an easy sell to our IT manager (he’s a Windows fan).

(Watching that video now, it’s just a bit long and I’m multitasking, so I keep having to jump back to it XD)

Just a bit long XD could have probably gone a little faster. Its also only the introduction there is a second video that goes deeper.

If you are really curious on how it all works that is:
http://channel9.msdn.com/Events/BUILD/BUILD2011/SAC-853T

I’ll check that one out too. I actually like that they go into some pretty good details. With Rackspace Cloud I got the details out of them, but it took several conversations with them to get them all out.

Oh, something else about Windows Azure: Does it just work with a proper stateless program, or if I develop with Windows Azure, I (and everyone we may sell this product to) is stuck with Windows Azure?

I’m rather familiar with stateless, scaleable software development so I can’t think of a reason it could, but they do describe a few not-so-standard things in this (like the Queue thing).

Thanks.

Symfony is on my “to learn” list this year

I was initially thinking of learning Zend as my new framework but for 2012 decided to settle on Symfony

I recently brought this book to help me: http://www.amazon.co.uk/Building-Applications-Symfony-CakePHP-Framework/dp/0470887346/ref=sr_1_sc_1?ie=UTF8&qid=1329981585&sr=8-1-spell

I’ve read about 100 pages and I must say I’m really impressed so far

It’s worth noting that after much discussion amongst Drupal developers it has been decided to incorporate a number of Symfony components into version 8

http://drupal.cocomore.com/blog/what-look-forward-drupal-8

Using Symfony2 components is a big part of this effort; Symfony2 is an open-source application framework with a lot of nicely abstracted and discrete components, several of which are being integrated into Drupal to build on its strengths as a CMS. The HttpFoundation and ClassLoader elements have already been added to Drupal 8, but the latest WSCCI Sprint, attended by almost all of the Drupal core developers most of us can probably name, along with Fabien Potencier, the Symfony lead developer, determined that several other Symfony2 components would also be included. While these changes may sound daunting to many long-time Drupal developers, it should actually make the core much more approachable for developers new to Drupal, while also making Drupal inviting to experienced Symfony developers. Additional benefits include reducing a the heavy load of Drupal requests, making it more “lean and mean” and providing partial page caching for example, while also delivering a number of powerful features for Panels-like applications, better blocks, and much, much more. Some of the work related to the WSCCI project has been underway for some time now and was encapsulated in a Drupal 7 development module called “Butler”. [Update: I had linked in the Butler project, but Larry Garfield has indicated it is “vestigial” and there is no way that any of the final WSCCI changes will be back-portable or functional as a D7 module.]

Its not stuck with Windows Azure by any means. It may need tweaking on another platform but that would be no different on another. Probably the only thing you would have to change is the messaging between the frontend and the backend as well as storage. Other then that, it would be regualr PHP.

Great, thanks. I’ve brought it up with my boss (who unsurprisingly has already looked at it multiple times) and I think we’ll be giving it a go with this project.

Are you talking Symfony 1 or 2?

I have only ever used 2 so I will talk a little about that.

The one thing you have to understand and commit to when learning Symfony is all the third party libraries that are used. When learning Symfony your not just learning Symfony but Twig, Doctrine, Unit testing, Assetic, etc. Though the documentation is excellent for most of those projects including Symfony which touches briefly on each topic.

it is always nice to get away from the same tools used day in and day out. Especially WP…

Lol, don’t knock WP, I’ve been defending it in another thread (though obviously I know it can’t do everything =p).

And yes, I am referring to Symfony2. Looks like there is a pretty big following of Symfony(1) still, so maybe I should start making the distinction.

The beauty of the third party library stuff is I was already planning on using Twig when I was building it from scratch, and I’m already familiar with unit testing (using PHPUnit… not sure if it uses the same or not, guess I’ll find out =p). I didn’t know about Doctrine, but now that I’m learning about it I’m starting to love it (I loved that I could automatically generate all of my models from my database last night =p).

Its fun learning new things, makes us more valuable as developers if we have skills in multiple areas. Plus it can get stale using the same thing all the time :stuck_out_tongue: Gotta work that brain.

  • Find it a remarkable you blog is named Xazure and here we are talking about Windows Azure. :stuck_out_tongue:

Just out of curiosity, what gave you that impression? Especially about the speed?

Well it’s from several years ago (last time I was active here). Every other thread was about which IDE is the best or which framework to use. It’s size (has a lot of features) and speed (slow) were the few comments that stuck with me. I have no personal experience with it so I have no opinion of this matter.

That could have been Symfony1 (just Symfony). I’m actually talking about Symfony2 (so I’ve learned =p).

From what I can tell, they’re pretty much two different beasts.

I’ve been using Symfony for a few days (just mucking around, will start doing some real work with it this weekend). So far, I’ve loved everything I’ve seen (which is kind of surprising because I generally tear apart frameworks and can point out a billion things I dislike).