The Official Klout Blog

Archive for October, 2012

Klout Perks Takes NYC Influencers to Microsoft’s Windows 8 Microtropolis

Thursday, October 25th, 2012


Here at Klout, we want to help people understand their influence, be recognized for it, and get some pretty awesome Perks in the process.

One of the ways Klout is doing this is by sending our influencers to top-notch, VIP events. Starting today, Klout Perks will help influencers already in an ‘Empire State of Mind’ get in a ‘Windows 8 State of Mind’ by making them VIPs at Microsoft’s Windows 8 Microtropolis event in New York City. Select Klout influencers will be offered VIP access to private events throughout the week, as well as exclusive Microtropolis swag bags. At Microtropolis, influencers will see a city brought to life through Windows 8 and other Microsoft products at various events between October 26th and November 3rd.

So you live in the New York City area and want to check out Microtropolis? Head over to Klout.com, and check your Perk notifications to see if you’re eligible. Be sure to move fast—spaces are limited and, as always, Perks are first come, first serve.

Posted in Perks | 10 Comments »

Klout Perks Wherever You Go

Wednesday, October 17th, 2012


Our goal at Klout is to help people understand and be recognized for their influence wherever they go.

One of the most visible ways we recognize influencers is through Klout Perks. Today, we are ready to take Perks to the next level—onto partner websites and your phone.

Perks provide influencers with exclusive access to products, services and experiences that match their interests. Perks also help businesses engage with influential people who are likely to help spread the word about their products. Since 2010, we have delivered more than 800,000 Perks to influencers through more than 450 partnerships. Some of our most recent Perks were also some of our most popular: free Sony X Headphones, early access to Nike’s Fuel Band and multi-day test drives of the new, electric Chevy Volt.

Perks on Your iPhone
We’re excited to announce that as of today’s release, you will be able to discover and claim Perks directly from your phone. Our updated iPhone app will notify you when you are eligible for pre-qualified Perks, and then allow you to claim that Perk immediately, wherever you are.

We’re also taking our iPhone experience a step deeper by including a full integration with Apple’s new Passbook. Using the updated version of our app, you can add your “Klout Card” to Passbook, which will display your name, photo and Klout Score all in one place. With your Klout Card, you can show off your influence and get access to special services and experiences from the businesses you love.

Perks around the Web
A few weeks ago, we released the KloutPass SDK, which allows partners to authenticate and register users with Klout. Today we are announcing that 500px—a Toronto-based photo community that lets you discover, share, buy and sell photographs—is the first partner to embrace our KloutPass SDK. Based on your Klout Score, you can receive savings off of your premium 500px account, up to 100 percent. More information about the 500px Perk is available here.

Perks on Klout
Finally, these new Perks avenues are accompanied by updates to the Klout.com Perks experience. We believe that everyone’s influence is unique, thus your Perks will now be more catered to you than ever before. They are also easier to claim and share with your friends, and will allow you to add yourself to a wait-list if you happen to miss something you like. So whether it’s a free Burt’s Bees gift pack or a spot at the open bar at next week’s Cadillac red carpet event, don’t forget to keep an eye on your inbox to see the Perks we have for you.

We’re really excited to give influencers more chances to be recognized, and we can’t wait to get your feedback.

Posted in announcements, Perks | 41 Comments »

Top Social Media Tools By Klout

Friday, October 12th, 2012


Many of us in the social media and tech world find ourselves juggling multiple different social media networks like Facebook, Twitter, Pinterest, Google+ and LinkedIn (not to mention multiple accounts on the same network). This month, we’re taking a look at social media tools and applications that help you manage your social media networks more effectively and efficiently. We will also look at how to effectively measure and extend your reach and what your audience responds well to.

We recently asked you to tell us your favorite social media tools and applications. We combined your responses with our own list of social media tools and then ranked these companies by Klout Score. See if your favorite social media tools made the list below:

Across the board, we heard a large amount of support for Hootsuite, TweetDeck, and Buffer. Tools like Hootsuite and Buffer allow you to manage multiple accounts from various social networks like Facebook, Twitter, and LinkedIn. Turns out these three social media tools made the top ten list! We’re also seeing some social media analytics companies such as Marketing Cloud (formally Radian6) and HubSpot which provide you with an in-depth analysis of your social media reach, buzz, and lead generation.

We want to involve you within social media, and we want your help shaping this conversation around topics you care about. What are some of your favorite social media tools you use to effectively manage your social media networks? Share with us in the comments below and we may highlight you in our next blog post about social media tools!

Posted in social media | 11 Comments »

How Klout Turned Big Data Into Giant Data

Thursday, October 11th, 2012


Last November, I wrote a post called Big Data, Bigger Brains. In that post, I wrote about how we were able to make business intelligence (BI) work in a Big Data environment at Klout. That was a big step forward for Klout, but our work wasn’t yet done. Recently we launched a whole new website and a new Klout Score that substantially upped the stakes.

Really Big Data

At Klout, we need to perform quick, deep analysis on vast amounts of user data. We need to set up complex alerts and monitors to ensure that our data collection and processing is accurate and timely. With our new Score, we increased the amount of signals we collected by four times. This means that we now collect and normalize more than 12 billion signals a day into a Hive data warehouse of more than 1 trillion rows. In addition, we have hundreds of millions of user profiles that translate into a massive “customer” dimension, rich with attributes. Our existing configuration of connecting Hive to SQL Server Analysis Services (SSAS) by using MySql as a staging area was no longer feasible.

Bye-Bye MySql

So, how did we eliminate MySql from the equation? Simple. We leveraged Microsoft’s Hive ODBC driver and SQL Server’s OpenQuery interface to connect the SSAS directly to Hive. Microsoft’s Kay Unkroth and Denny Lee and myself wrote a whitepaper detailing the specifics here. Now, we process 12 billion rows a day by leveraging the power of Hadoop and HiveQL right from within SSAS. For our largest cube, it takes about an hour to update a day’s worth of data – yes, 12 billions rows worth. By combining a great OLAP engine like SSAS with Hive, we get the best of both worlds: 1 trillion rows of granular data exposed through a interactive query interface compatible with existing business intelligence tools.

What I really want for Christmas…

So, what’s wrong with this story? What I really want is the OLAP engine itself to reside alongside of Hive/Hadoop, rather than live alone in a non-clustered environment. If the multi-dimensional engine resided inside HDFS, we could eliminate the double-write (write to HDFS, write to the cube) and leverage the aggregate memory and disk available across the Hadoop cluster for virtually unlimited scale out. As an added benefit, a single write would eliminate latency and vastly simplify the operational environment. I can dream, can’t I?

Do you want to take on Big Data challenges like this? We’re looking for great engineers who can think out of the box. Check us out.

Posted in engineering | 8 Comments »

Klout Gets Hacking

Friday, October 5th, 2012


The end of the quarter is the perfect time to take a day (or two or three) to celebrate the awesome work completed the past 90 days. And what better way to celebrate than…more work?! Well, a hackathon to be precise.


The Front End team discussing their Hackathon project

For those unfamiliar, a hackathon is a contest where developers (designers, marketers and product-minded folk are also welcome) work for a designated amount of time—24 hours or a weekend usually—to bring a new product, software, etc., from inception to prototype. It’s a bit of an engineering tradition, picking up steam in startups and particular industries, many of which host internal and external events and award prizes to the winners.


Klout team working on their code and design during the Klout Hackathon

Klout hosted a 24-hour internal hackathon for Klout employees to work on pet projects, innovations, and new ideas using our usual product roadmap. While we can’t promise that you’ll see any of these work their way on to Klout.com, we’re excited to find a place for many of the projects in the future. The turnout was impressive: 17 teams of one to four people worked on ambitious projects. Here are a few of them:

The winning app was an Influence Landscape Visualization by Keith Walker. Keith took a concept we’ve talked about many times, and have seen a few of our Partner Developers implement on our API in the past: plot the influence graph of a user and make it a visual experience. An influencer’s connections are displayed as dots of increasing magnitude relative to their Klout Score. You can drill down on any of these connections to then see that influencer’s connections, and so on and so forth down the rabbit hole.

Our second winning hack looked at surfacing new insights from our recent Klout Moments feature. Casting them through the lens of location and your immediate network, this team (consisting of Mao Ye, Mark Azevedo, Sreevatsan Raman, and Adithya Rao) actually conceived this as two separate projects, then realized they could easily mesh into one. Moments can be viewed by city, allowing you to view the top influential content in San Francisco. Curious what the people you influence are saying? Their recommended moments surface their top content.

The rest of the submissions were no less notable, including heat cloud visualizations, sentiment analysis, scientific discovery of movers and shakers, real-time backend tracking, an influential business radar, a new scoring system for career growth, and a uniquely polished presentation for affiliate marketing for bars and clubs. Even our CEO, Joe Fernandez, piloted a group to success, offering a new take on creating a street team for mobilizing your influencer network to drive change and get the word out utilizing our notification system and circles.

We plan to continue a new tradition of this each quarter, and know that each time the quality of work will be top-notch and find its way into the Klout experience. All of the teams did a fantastic job and showed a diversity of approach and vision while also cohesively rallying around concepts we’ve collectively considered for some time now. We couldn’t be more proud.

Posted in engineering | No Comments »

Scaling the Klout API with Scala, Akka, and Play

Tuesday, October 2nd, 2012


Back in March, Felipe Oliveira wrote about Klout’s new Sexy API. We had just released the Scala Play! Framework API infrastructure that we had been writing the previous few months. Not only did it represent a big step forward on the tech side, but it was also an important cultural change for Klout. Previously, disparate teams were responsible for their own serving infrastructure; now, having a central platform has empowered Klout to scale to a billion API requests per day and export powerful new functionality to partners.

But we still had a lot of work to do back then. By now, six months after launch, we’ve made some serious improvements to the API’s scalability and availability using Akka’s rich toolset for concurrent programming. Though Akka is mostly famous for its implementation of the Actor Model, I’m going to talk about two other Akka features, Futures and Agents.

Scalability with Akka Futures

For some background on the scalability problems we face, consider that serving a simple profile page like mine (see below), requires hundreds of lookups to several different datastores. Because of the scale of Klout’s data pipeline (expect a future blog post by Sreevatsan Raman to shed more light), we need to store users’ Scores, Moments, Topics and other data all in different datastores. As such, our app is very IO bound and optimizing our IO usage was one of our biggest priorities. We needed to do our IO concurrently.

dyross

Akka Futures (soon to be part of the Scala Standard Library) have proven to be the ideal tool for concurrent work. A Future represents an asynchronous computation and many Futures can be created in parallel. The Future API in Akka is very rich, but the key for us is its monadic nature. If you don’t know what a monad is, in Scala, it is something that has the map and flatMap methods. This allows Futures to be composed into new Futures with the syntactic sugar of a for expression. Compare this to Java Futures (java.util.concurrent.*), which have no means of composition.

Consider the following example, which has three methods that call different datastores and each return a Future:

[gist id=3815934 file=futuresSetup.scala]

Additionally, we have a resulting type we’d like to combine the results into:

[gist id=3815934 file=profile.scala]

Now, how should we do this? The non-monadic way, similar to how we would do it in Java, is to start each of the tasks, wait for them, and then build the result:

[gist id=3815934 file=futureBad.scala]

This is not ideal for a few reasons:

1. We are blocking on the execution of the concurrent tasks, which means the thread running this code must wait idly, wasting resources while the app is making network IO.
2. It is rather verbose and difficult to maintain.
3. This function violates the Single Responsibility Principle, because it is responsible for both the waiting of the Future and business logic for combining the results.

A better way to do this is with Future composition:

[gist id=3815934 file=futureGood.scala]

Notice how much more readable the code is. The for expression is sugar for calling the map and flatMap methods on the Futures, and the benefit is that we can refer to the results of the Futures in the yield block without waiting for them. This makes the method read more like a workflow and it is no longer concerned with waiting for the completion of the tasks.

One difference between the two methods is that the first returns a raw Profile and the second returns a Future[Profile]. This leads to an important realization, in the form of simple rules, we had while adding Futures to our code:

1. All methods that do IO should return a Future
2. Never block a thread waiting on a Future
3. Therefore, all methods that call other methods that return Futures must themselves return Futures.

In this way, we use Future almost like an IO monad (see this post for an introduction to functional IO). This allows us to push the Futures all the way up our call stack, finally wrapping them in Play’s AsyncResult in controller methods. Play handles these results in a non-blocking way, so we can be as efficient with IO as possible. (See the Play documentation for more detail).

Overall, the strategy of using Akka Future allows us to write more efficient and more readable code. I suggest becoming very familiar with the methods on Futures and the different ways to compose them, especially since they will be shipped with Scala 2.10 and later. The ability to write concurrent IO so easily is the key to our API’s performance and scalability.

High Availability with Apache Zookeeper and Akka Agents

Another one of our learnings in the last six months is that dynamic service discovery is key. For example, our MySQL cluster has one master and several slaves, and we spread read requests across the slaves as much as possible. Sometimes we need to dynamically remove slave nodes from the pool because of degraded performance or scheduled maintenance. Since we a large production cluster of API nodes, we need a to be able to make updates without re-deploying or downtime, giving our clients the best experience possible and guaranteeing that all nodes update within seconds.

Apache Zookeeper was an obvious solution for distributed configuration. To start, we created a simple wrapper for ZooKeeper on top of Twitter’s ZooKeeper client written in Scala. We use this wrapper to watch ZooKeeper nodes, issuing a callback inside our application whenever a modification happens:

[gist id=3815934 file=zk.scala]

But where should these callbacks go? One solution would be to create a service like this:

[gist id=3815934 file=stateBad.scala]

This service would keep track of nodes to read from, and we could use the zookeeper client to call updateState on the service. Any read request for MySQL would use the service to determine the pool of nodes to read from.

Again, there are a couple of problems with this:

1. The same class that deals with business logic is responsible for making updates, so the interface is not safe. Clients of this service would be able to make changes when we only want Zookeeper callbacks to make these changes.
2. This service would be prone to concurrency issues when multiple threads are making updates. These issues amplify exponentially if we want to add more features to our “MySQL State” than just “up” or “down”.

At first, we thought that Actors would be a good solution for this problem. However, we soon learned that because actors process all messages one at a time, the reads would get backed up. Also, the interface to the actors is Futures, which is more complex than necessary.

Akka thankfully provides an implementation of Agents, based off of the concept by the same name from Clojure. Agents wrap an instance of some type of state and support asynchronous single-threaded updaters and synchronous getters. For an agent of type T, the updater is a function from T => T, and the agent updates its state by changing its value to the result of the function applied to it’s previous value.

Here’s a similar implementation of the service above but using an Agent:

[gist id=3815934 file=stateGood.scala]

As you can see, the service is much simpler and the interface hides the updating access. Also, because the update functions are applied one at a time and simply add or remove nodes from the set, there is no concurrency issue. The biggest win, however, is that this allows us to think about our state as an immutable data structure, only responsible for dealing with business logic, and wrap the updating logic in the Agent. This gives us an elegant structure to our code.

We like this pattern so much that we use it wherever we have dynamic configuration depending on Zookeeper. It’s a great abstraction that allows for both more reliable and more readable code. And having this mechanism for dynamic service discovery gives the API fault tolerance and high availability it needs to meet its SLA.

Even if you are not using the Actor Model, Akka provides many tools to improve large concurrent enterprise systems. In some cases, other abstractions are simpler to use and require less boilerplate than Actors. At Klout, we believe in using the right tool for the job, so to help the Klout API meet SLA, we have used Future and Agents heavily. In doing so, we hope to push more and more of Klout’s data into the world. Let us know if you want to help.

Posted in engineering | 14 Comments »