Sexy API from Klout

Klout had an incredible 2011, and as the end of the year approached I felt so proud to be part of such an amazing team! We accomplished a lot, so the holidays came at a great time; it was a much-needed opportunity for the team to catch a break and have some fun with our families. At the same time, I was excited about all the incredible things we were gonna have a blast building. So when January 2nd came along, I was back at Klout HQ ready to go; as is customary at Klout, there was a fun challenge ahead. We’ve been hard at work for the past few months and we’re excited to share with you what we’ve built.

The challenge was to re-engineer Klout’s API to sustain its rapid growth and massive traffic—ten billion API calls a month and growing—and also to empower our clients with all the features currently available on Klout.com.

So I started by concentrating on the problem at hand; I find it much more productive than jumping into the solution or any implementation detail, going against our instinct as engineers. There’s a small select group of companies serving that type of massive API traffic but a peculiar number screams out of the infographic above. Klout is the only one with less than seven hundred employees; we actually only have about 76 troopers! And what does that number represent? That number tells me that as fast as our API should be, we need to be moving even faster as a team–we need killer productivity! Besides, everyone likes to go fast!

Let’s Play!

As seems to be a recurring fact in my life—see more on Why Did I Fall in Love with Play! Framework?—the technology stack chosen was the always awesome, lean-and-mean, super-duper productive Play! Framework. As I mentioned on my previous blog post, Find Your Klout, Play was designed to provide a powerful, easy to extend infrastructure, it uses fast non-blocking IO, and it uses a stateless model that makes horizontal scaling a cakewalk. There is such a joy that comes every time my terminal sings “play new klout-* –with scala”. And with this type of traffic, our API might just be the most heavily used Play! Framework application to date!

Our API has Swagger

We were obviously going to create a RESTful API, but there are some components of SOAP (Simple Object Access Protocol) that have a lot of value. Even though I wanted no part of that business, in any shape or form, new or old, and its verbose XML format (remember the productivity factor) the WSDL (Web Service Definition Language) does provides features that aren’t commonly seen in REST. The WSDL allows client proxies to be automatically generated (wsdl2java comes to mind); it also allows developers to create client interfaces easily. How could we accomplish that without deep-diving into thousands of lines of XML? Swagger son! Here’s how Wordnik defines their marvel: “Swagger is a specification and complete framework implementation for describing, producing, consuming, and visualizing RESTful web services.” Swagger allows our API to have a well-defined contract in JSON, the same format we are using on every single endpoint.

“Talk is cheap. Show me the code.” – Linus Torvalds

First of all, add the dependency on Swagger Play to your conf/dependencies.yml and run “play deps”. Then go ahead and define your data transfer class.

Now it’s time to define the controller. All the @Api* annotations are provided by Swagger. The code you are about to see doesn’t do much other instantiating the Score class and setting its value to 100 (I wish that was my Klout score).

We created an API trait to define all the business logic used on every endpoint. This trait provides an api method which we wrap each controller action with; this method does the validation, JSON transformation, and it tracks number of calls and response times with StatsD using David Ross’ super useful StatsD module. Stay tuned in our blog for another post on StatsD and our monitoring infrastructure soon.

Now it’s time to define our REST-friendly route for our endpoint, a walk-in-the-park with my beloved Play! Framework. To do that add the following line to conf/routes.

Caching is being done using Memcached, re-using Play’s support for it. Jay Taylor, Klout Perks’ lead engineer, wrote a nice wrapper for it.

We’re excited that the Play framework is now commercially supported by Typesafe, along with Akka and the Scala, all of which are firing on all cylinders at Klout. Building on a modern foundation like the Typesafe Stack makes it much easier for our development team to punch above its weight!

Any word on when other networks will be integrated into the Klout score?

http://www.x88x.com/ مركز تحميل الصور

+11

http://www.x88x.com/ مركز تحميل الصور

+11

http://www.soccereur.net/ cheap soccer cleats

Barcelona forward VS Granada:17 consecutive home games
La Liga in one week double match, the cheap soccer cleats twenty-ninth round of the Barcelona will be based at home against newly-promoted Granada, have the cheap soccer jerseysopportunity with Real Madrid will narrow the difference to 5 minutes.
Two teams of Spanish history engages in a contest 35, buy soccer cleatsPalestinian Sa 27wins and 4draws and 4 defeats occupy absolute advantage, with 17 home matches,nike soccer cleats scoring 64goals to lose 15 balls. Recent 9 confrontation, red and blue8 win1 Pingyao far ahead, this season first round at,adidas soccer cleats by virtue of Harvey from a free-kick, Barcelona win 1-0.
Barcelona official Monday corrected the history top scorer Cesar: puma soccer cleatsofficial goal data, according to Club Centre for research and documentation and" Herald" cooperative statistical,mizuno soccer cleats Cesar altogether in 1942to 1955, as Barcelona scored 232 goals, before reported less than3ball, cristiano ronaldo cleatsthis also means that Messi from becoming top scorer in team history only one step, the epicycle league tournament the didier drogba cleats Nou Camp is expected to witness this moment fans.
This lionel messi soccer cleats week to prepare for training in this season due to injury, almost destroyed afelly injury for the wayne rooney cleatsfirst time participated in joint training team, is expected to return at the end of the season. Adidas AdipureIn addition to David Villa fonts and Abidal three long-term injuries, Adidas Adipure IV TRXthe remaining players are in place.
One week double game, be imperative on wheel rotation,Adidas Adipure IV SL TRX sat the bench in Puyol is expected to replace Peake with partner Mascherano,Adidas Predator and Keita outstanding before a chance for Busquets to catch his breath, attack,Adidas Adipower Predator TRX return in Thebes, Juan kicked a field to find the feeling Sanchez, should be able Adidas Adipower Predator SL to return to the starting lineup.
The low-key Iniesta Barca really vignettes, previously defeated Seville,adidas F50 Adizero is a small white last fiftieth League appearances for Barcelona and unbeaten Adidas F50 Adizero TRXteam this season, which was 14wins and 4 draws, with Getafe and Osasuna two battle the Spanish international has Adidas F50 Adizero Prime SL not played.
The if can still led the team to remain undefeated,Nike CTR360 Iniesta will be unbeaten in 51 games, breaking the former giant Real Madrid Butragueno Nike CTR360 Maestri II Elite remain unbeaten in 50league record, become the first Nike Total 90person. In addition, the white42victories and 8 draws, is better than that of Nike Total 90 Laser III Elitethe" vulture" wrote34wins and 16 draws.
Malaga, Real Madrid, Spain’s four largest sports newspaper in the analysis Nike Total 90 Laser IV of two fixtures, Barcelona deficit of likelihood. But Guardiola attitude Nike Mercurialstill, Barcelona only digits on the probability:" it’s hard to see them lose more points, I still don’t think we will win the league,Nike Mercurial Vapor Superfly II digital says that this is possible, but I don’t think we can do it."
" If I were each month to attend a press conference,Basketball shoes I might change my mind, but not now, three days ago I just said it, impossible,Nike Zoom Kobe VII and no change. Real Madrid had the opportunity to play12 games,lebron 9 and we’re going to play the Spanish and Bilbao, away at Rayo Vallecano, kobe viito win all 11difficult. This time we are far behind the score, of course, with the dream of life is adizero rose 2.5good."
The race because of the relationship, Granada midfielder Carlos Martins to join the Nba shoesleague. The League last weekend, Carlos – Martins scored a beautiful free kevin durant shoeskick, but was substituted after insulting the referee was given a adizero derrick rosered card. However the club appeal, the Wednesday League disciplinary committee will be announced on the adizero roselast round of League punishment result, means that the Portuguese international can still participate in the League at barcelona.