Wii U

I've had a Wii U for a few months now and I'd like to say a couple of things. I'd been eyeing one ever since they came and come November I bought one. I love it. Not that there aren't issues, or that it's a home run, but it does have many redeeming qualities.

The hardware

There's an elephant in the room I feel we need to address. I know that the Wii U isn't as graphically advanced as the Xbox One or the PS4. I think it's unfair to call it on par with the Xbox 360 or the PS3, it quite obviously produces better graphics than both those two, but it is fair to say that out of the 8th generation consoles the graphics are the least advanced.

Now, is this an issue? No. Really, the graphics look good. Not AS good as the PS4, but good. The Wii U was the first 8th generation console to arrive, and it's not unexpected that consoles arriving a year later will have better graphics.

I'd also like to talk about the gamepad. I'm not overly impressed with it. Some games do take advantage of the second screen, and that is pretty awesome. It's really nice to have your inventory or your map or whatever on the gamepad so you don't have to pause your game to check those.

Most games however don't actually use the second screen for anything but off-TV play. Now, I'm sure that for some off-TV play is great, but for me, I couldn't give two shits about it. If I want to play I'm gonna do it on my TV, not on some low-res gamepad screen. It's not even a retina display. It works great as an auxilliary display, but for gaming? Please.

As a controller, the gamepad is clunky and not too comfortable. On the other hand, the Wii U Pro Controller is amazingly comfortable. It's even better than the Xbox 360 controller. So unless you're playing a game like ZombiU where the seconds screen is being used, ditch the gamepad and get a Wii U Pro Controller.

It's also cool that you're able to use your old Wii Controllers. Some games even require them, so dust off your old MotionPlus controllers and nunchuks.

The games

This is where the console really shines. I know some people are probably going to disagree here, because the Wii U hasn't been getting a lot of third party love lately.

I say screw third parties. The only AAA third party title I'm missing is GTA V, because most third party titles are just shitty FPS:es anyway.

The Wii U brings plenty of great titles, like Super Mario 3D World, Donkey Kong Country Tropical Freeze, Pikmin 3, The Wind Waker HD, NES Remix and Wii Sports Club. There are also amazing third party titles like Ducktales available through the Nintendo eShop.

All of the 8th generation games that I'm excited about right now are on the Wii U. The PS4 and the Xbox One can stick to their shitty FPSes, and I'll take the Wii U with awesome old-school platformers. I'm fine with that deal.

Furthermore, there are no microtransactions or free-to-play games on Wii U. Microtransactions are ruining gaming, and the Wii U doesn't have them. Big plus for the Wii U.

In comparing the Wii U to the Xbox One or the PS4, I find that Nintendo is definitely going more old-school, and that's a very good thing. A lot of modern games have been ruined by being too easy or being free-to-play or senseless online multiplayer modes. The Wii U takes us back to a time where you'd spend hours grinding the brutal platforming jumps of a small part of a really difficult level. A time where Nintendo hard meant something. A time where you had two lives, one continue and that was it. A time where the learning paradigm wasn't tutorials, but learning by dying. A better time.

The future

There are some really good games coming up on the Wii U. Mario Kart 8, the unnamed upcoming Zelda game and Super Smash Bros. There are some uncertainty as to how many awesome games Nintendo can produce by themselves. In that sense we may find that in a year or two the PS4 or the Xbox One will have a more impressive library of games, but right now, even considering the coming 6-12 months, I'd still prefer the Wii U lineup. There is a backlog of awesome games, and more awesome games coming up.

Publicerad February 23rd i Tech

Improving Symfony workers

I've been doing workers in Symfony for quite a while now. E-butik used workers that were written as a daemon in PHP, polling from a beanstalkd server. Because that worked poorly (memory leaks, crashing, mysterious behaviour etc.), we also used Scala workers.

At Redeye, we're using Sidekiq, launching a Symfony console command for each job. This works well, but that's because the worker load is low. Launching a console command is quite expensive.

A few weeks ago I heard that OpenSky forwards Symfony events to their message queue, and their worker simply dispatching events back into the event dispatcher (but of course in a separate process). More information about the OpenSky architecture (seriously recommended read!) is available in Jonathan Wage's (@jwage) presentation "Building OpenSky with Symfony2"

This friday at November Camp I listened to Ville Mattilla's (@vjom) presentation "Running scalable and reliable Symfony2 applications", and found out that they're basically doing the same thing as we did at Redeye, they're launching a command from their worker daemon.

Up until then it had seemed there were basically three options.

  1. Use a single PHP worker process to run the jobs, and deal with stability problems
  2. Launch a new process for each job, and have bad performance
  3. Use another language for your workers

That's when it hit me like a slippery fish. This performance problem is already solved, by PHP-FPM. You see, this is exactly the same problem that people had with CGI. Launching a new process for every request is slow, FPM was created to allow the PHP engine to keep running between requests, but to still clear PHP's internal state between requests, nipping any memory leaks or crashes in the bud.

FervoDeferredEventBundle

Having some previous experience with FastCGI I took it upon myself to fix this problem once and for all, and the result is FervoDeferredEventBundle.

FervoDeferredEventBundle allows you to defer execution of events, either by dispatching a wrapping event, or by calling a method on a service:

Events:

$evt = new DeferEvent('foo.action', new FooActionEvent());
$eventDispatcher->dispatch('fervo.defer', $evt);

Service:

$evt = new FooActionEvent();
$evt->setName('foo.action');
$container->get('fervo_dispatch.queue')->deferEvent($evt);

As if by magic, at some later time, a worker will dispatch your event into the event dispatcher. Pretty much the only caveats you'll need to keep in mind is that it is in another process, and that the code isn't executing in the request scope anymore.

Of course FervoDeferredEventBundle required some kind of a message queue and a worker. I decided upon using Sidekiq, but the bundle itself is fairly backend agnostic, and should be easily portable to other MQs.

Using PHP-FPM brings two other advantages. First of all, you can set up a separate FPM pool for your workers, making sure that workers cannot run amok and crash your server. Secondly, since FastCGI uses TCP Sockets, you can have your FPM pool on a separate machine from your workers, allowing you to keep your PHP machines free from the Ruby runtime and vice versa.

FervoDeferredEventBundle is available at Github, along with the worker. While the bundle is pretty nice, there's probably some work to be done on the worker. I'm not a Ruby programmer, and I'm fairly sure it shows :)

Performance

I decided to also create a performance test in order to see what kind of a speedup this might get. The listener for the deferred event is very simple, just doing a usleep(5) to simulate a database transaction or whatever.

I wrote up a small command to dispatch 1000 deferred events, and did some simple measurements comparing using FastCGI to launching new processes. Since FervoDispatchBundle uses a command to dispatch the deferred event, the only PHP code difference is how that command is invoked (and even that is very similar). This means that pretty much the entire difference comes from using FastCGI vs. creating a new process. I took the measurements using Sidekiq's built in logging.

FastCGI Popen
Average 0.515 0.909
Median 0.085 0.911
Min 0.016 0.446
Max 2.246 1.041
Stdev 0.747 0.046

As you can see, the FastCGI implementation fluctuates a lot, but is on average 2x faster, and has a 10x median speedup. I also noted that using popen maxed out my CPUs, while the FastCGI implementation barely made a dent on the CPU load. The tests were run on my Quad Core Retina Macbook Pro (2011) with 16 GB RAM.

For all you number crunchers out there, the raw data is available in a Google Spreadsheet.

Conclusion

I'm not claiming that my numbers are definite, I'm sure there's plenty to do implementation-wise, and that my setup isn't at all tuned for running workers, but it should serve well as an indicator that using FastCGI for running your workers is worth pursuing.

Like I said, the code is available on Github, and will probably be going into production soon. Feel free to send pull requests!

Publicerad November 25th i Fervo, Symfony

Inflyttning

Idag var det en stor dag. Från att ha varit anställd på ett väletablerat bolag (som f.ö. blev uppköpt i förra veckan, grattis Jetshop till vad jag tror kommer visa sig vara ett bra förvärv!) så har jag nu blivit heltidsanställd i mitt eget väldigt färska bolag, Fervo. Verkligheten i det hela slog mig inte riktigt förrän i helgen, när jag insåg att min vardag kommer se helt annorlunda ut, och att jag själv plötsligt är enkom ansvarig för mitt eget uppehälle. Hittills har jag ju alltid haft någon annan i bakgrunden som "säkerhetsnät", mina föräldrar, min arbetsgivare; men så känns det inte längre. Nu hänger allt på mig, hur väl jag lyckas nätverka och sälja in mina tjänster, hur bra jag lyckas växa företaget. Det blir en annorlunda vardag, och en välkommen utmaning.

Annorlunda är inte dåligt. Idag hade jag min första heltidsdag för Fervo. Jag flyttade in på det nya kontoret på Sveavägen 98, något jag är väldigt nöjd med. Kontoret, som är ett skrivbord hos kontorshotellet The Park, är fräscht, välventillerat (somliga vet vad jag pratar om) och har en bra livlig buzz i luften. Allt är inte på plats än, och jag ska göra lite inköp till kontoret vid tillfälle, men med min pålitliga MacBook Pro och Wi-fi så fick jag ändå massor gjort. Jag funderade på att ta lite bilder, men jag valde bort det eftersom min arbetsplats ser ut ungefär som ett skrivbord brukar göra, och andra bilder finns att beskåda på The Parks site.

Nu gäller det bara att koda, hjälpa, nätverka, vårda kundrelationer, sälja och hålla ordning och reda i ekonomin och kassaflödet, i ungefär den ordningen! Som tur är så står jag ju inte själv utan hjälp, men det är helt klart nya utmaningar!

Publicerad September 2nd i Fervo

Spännande nyheter

English summary below

Somliga känner redan till det här huvuddragen av det här, men jag tar det ändå. Jag har sagt upp mig från E-butik effektivt den sista augusti. Från och med första september kommer jag istället arbeta för mig själv som Symfony/PHP-konsult i mitt nystartade bolag Fervo AB.

Det är naturligtvis inte utan blandade känslor; jag har ju jobbat i snart fyra år för E-butik, men jag känner att det är dags för lite nya utmaningar nu. Jag har drivit eget företag som en sidoverksamhet sedan 2007 (hittills som HB, men nu har jag som sagt ett AB), och det ska bli riktigt spännande att börja arbeta för mig själv på heltid.

Även om jag inte lämnar E-butik helt — de blir en av Fervos kunder — så vill jag ändå ta tillfället i akt att önska lycka och framgång till E-butik och till mina kollegor där.

Jag har någon slags föreställning om att det kommer kännas väldigt bra att på bästa Hank Rearden-manér stå på mina egna två ben och vara min egen lyckas smed. Jag har inte någon slags villfarelse om att det kommer vara lätt hela tiden. Jag räknar till fullo med att jag kommer möta helt nya slags utmaningar, inte bara för att tjäna mitt eget uppehälle, utan för att driva Fervo till att nå sin fulla potential.

Jag kommer blogga om den resan här. Jag och Johan har många idéer om hur vi vill driva Fervo. Somliga kanske är lite väl far out there, men det ska bli spännande att se vad vi kan lyckas göra med företaget.

Så vad är då kontentan? Jo, om du behöver hjälp i ditt Symfony-projekt så är det ju naturligtvis mig du ska kontakta! Jag är Sveriges (hittills) enda SensioLabs-certifierade Symfony-utvecklare, och jag finns tillgänglig från och med 1 september. Jag kan hjälpa dig komma igång med ditt Symfony-projekt, guida dig till rätt vägval när det gäller teknologier och klassupplägg. Jag kan lära dina utvecklare hur de skriver riktigt bra Symfony-kod. Jag kan även hjälpa dig med genomförandet: att faktiskt sitta och koda på ditt projekt.

Om du behöver hjälp med hela projektet, då ska du också ta kontakt. Min erfarenhet av den tekniska sidan och Johans erfarenhet av användbarhet/interaktionsdesign gör att vi kan skapa lösningar med både användaren, affärsmålen och tekniken i fokus.

Vår hemsida är uppe och kan beskådas på fervo.se. Du kan även kontakta oss på info@fervo.se så berättar vi mer!

English summary

I have resigned from my position at E-butik, effective August 31th. September 1st I will start working for myself as a Symfony/PHP consultant in my newly formed company Fervo AB. I am very excited about this opportunity, and I wish everyone at E-butik the best.

If you need help in your Symfony project, contact me! I am the only (at the time of writing) SensioLabs certified Symfony Developer in all of Sweden, and I am available from September 1st. I am able to help you get started with your Symfony project, guide you to the right choices with regards to both which technologies to use and how you design your classes. I can teach your developers how write great Symfony code. I can also help you realize your project, i.e. actually writing code for you.

If you need help with an entire project, you should also contact me! My experience with the technical side and Johan's experience with the usability/interaction design gives us the ability to create solutions with both the user, the business goals and the technology in focus.

Our web site is up (in swedish at) fervo.se. If you want information in English, or want to know more about our services, please contact us at info@fervo.se, and we'll be happy to tell you!

Publicerad August 9th i Fervo

The PyCon disaster

I feel no need to give names here. You probably already know the names anyway, but it's not pertinent.

I wasn't going to write this post. I do realize that by publishing it, I am just making things worse, but I argue that since my blog is not well visited the damage is minor. I still want to get this off my mind.

So, everyone following the tech industry probably knows what happened. An attendee ("the jokester") made a bad joke in poor taste at PyCon. Another attendee ("the attendee speaking up") took a picture, and posted it online, while also calling the incident to the staff's attention.

The infamous joke was about "big dongles", and there had been previous talk about forking. To me, the joke wasn't particularily offensive, but it WAS unprofessional and against the PyCon Code of Conduct. Calling it to the attention of the staff was entirely appropriate, and the staff handled the incident well. The jokester apologized, and was basically let off with a warning.

Sadly, that wasn't the end of it, presumably due to the posting of the jokester's (and other attendees') picture on Twitter. For the record, I believe that this response was inappropriate and out of proportion.

What happened next isn't really clear. People were enraged, both by the joke, the attendee speaking up and the manner in which it was done. The jokester was fired for reasons undisclosed, but presumed to relate to the joke and the following outrage.

That's when all hell started to break loose. Companies were DDOSed. People started receiving death threats or rape threats. Lots of them. And not just people directly involved, but people simply having an opinion on the matter. When we all thought this was about to blow over, the attendee speaking up was also let go, adding new fuel to the fire.

What the fuck?

Since when is it even REMOTELY okay to start sending people death threats, or rape threats or threats of any form of harm? What the hell happened to resolving conflicts like adults? Sure, mistakes were made, and people even lost their jobs because of them, but death threats? What's wrong with people?

Of course, there is another angle into this. The jokester was male, and the attendee speaking up was female. Most of the people getting flak (certainly rape threats) over this are women. Not because women are the only people who wants an inclusive work environment, because they're not, but in all likelyhood simply because they are women who dare speaking up.

This is fucked up. If you want to critizise the attendee speaking up, or feminism in either tech or society in general, feel free to do so. But do so in a civilized manner. Have a discussion like a normal adult, instead of lashing out like a 12-year-old.

Publicerad March 23rd i Equality

Magnus Nordlander

Symfony-utvecklare extraordinaire, begynnande audiofil och en all around nerd. Skriver om tech och/eller livet i allmänhet.

Jag finns även på

GitHub
github.com/
magnusnordlander
Twitter
drrotmos
Facebook
facebook.com/
magnus.nordlander
LinkedIn
linkedin.com/in/
magnusnordlander

Andra bra grejer