Posts Tagged ‘developers’

December 21, 2011

Spot Influence: Tech Partner Spotlight

By in Partner Marketplace, Social Media, SoftLayer

This is a guest blog from Spot Influence. Spot Influence provides businesses with detailed information on who’s influential in the world of social media and what those influencers actually care about. This data, accessed via an API, enables companies to react faster with more information and, more importantly, to be proactive and execute a strategic social media plan.

Discover the People Who Drive Your Business

If you’re involved in marketing, you understand the importance of monitoring your business’s community online. You also probably know that engaging with the “Influencers” who speak to your intended audience can be critical to understanding their needs and spreading your brand’s message. But existing tools are limited in their ability to find these individuals. They don’t allow you to sift through the noise and discover the people who are already impacting your business online.

Spot Influence is a data service that provides granular, actionable information to businesses about their online audience and the people who are influencing them. With this data, business can discover the key influencers they need to be paying attention to and gain valuable insight regarding their existing customers: their online profiles, where they publish and engage with content, and what they care about.

Solving this problem at scale is incredibly challenging. We deal with vast amounts of unstructured data, processing tens of millions of URLs and creating terabytes of data every day. That’s why we’re excited to be a SoftLayer customer and a part of the Technology Partners Marketplace. SoftLayer enables us to cost-effectively scale our machines to meet customer needs.

If you’re interested in learning more about Spot Influence, please check out the following links and sign up for the Beta on our website!

Website: http://spotinfluence.com/
Blog: http://blog.spotinfluence.com/
Twitter: @spotinfluence

-Dave Angulo and Rich Grote, Co-Founders, Spot Influence

This guest blog series highlights companies in SoftLayer’s Technology Partners Marketplace.
These Partners have built their businesses on the SoftLayer Platform, and we’re excited for them to tell their stories. New Partners will be added to the Marketplace each month, so stay tuned for many more come.
August 16, 2011

SLDN 2.0 – The Development Network Evolved

By in Development, SoftLayer, Technology, Tips and Tricks

SoftLayer is in a constant state of change … It’s not that bad change we all fear; it’s the type of change that allows you to stretch the boundaries of your normal experience and run like a penguin … Because I got some strange looks when coworkers read “run like a penguin,” I should explain that I recently visited Moody Gardens in Galveston and saw penguins get crazy excited when they were about to get fed, so that’s the best visual I could come up with. Since I enjoy a challenge (and enjoy running around like a penguin), when I was asked to design the new version of SLDN, I was excited.

The goal was simple: Take our already amazing documentation software infrastructure and make it better. A large part of this was to collapse our multi-site approach down into a single unified user experience. Somewhere along the way, “When is the proposal going to be ready?” became “When is the site going to be ready?”, at this point I realized that all of the hurdles I had been trampling over in my cerebral site building were now still there, standing, waiting for me on my second lap.

I recently had the honor to present our ideas, philosophy and share some insight into the technical details of the site at OSCON 2011, and KHazzy had the forethought to record it for all of you!

It’s a difficult balance to provide details and not bore the audience with tech specs, so I tried to keep the presentation relatively light to encourage attendees (and now viewers) to ask questions about areas they want a little more information about. If you’re looking at a similar project in the future, feel free to bounce ideas off me, and I’ll steer you clear of a few land mines I happened upon.

-Phil

May 9, 2011

Will Write Poetry for Servers

By in Culture, Executive Blog, Funny, SoftLayer

Two weeks ago, I inadvertently opened the floodgates to a wave of creativity from the SoftLayer Development/Technology organization. Lance came by my office and dropped off a server he was given, and while I would have taken it home, souped it up and done something cool with it in previous years (or decades) in my life, I find myself in more of a “just buy an iMac” camp now.

Rather than endanger the safety of our employees by sending out a “First one to grab the server from my office gets to keep it” email, I sent out more of a challenge: “Write a haiku or limerick stating why you want the server. If I get more than one submission, I’ll pick the best poem. Oh … And no Nantucket limericks.”

I expected one or two entries to come in, but to my surprise, I was greeted with dozens almost immediately:

Windows NT crashed.
I am the Blue Screen of Death.
No one hears your screams.

There was a young man with a lance
Who had three kids to finance
Yes they look and they see
Asking for a PC
But their dad said no not a chance

Linux or Windows
Not up to how the wind blows
The penguin’s a go

When you’re whipping your verse into shape
And are caught in a verse-challenged scrape,
The delete key is handy.
Assisted by brandy,
And last, but not least, try escape.

Given the overwhelming initial response, we sweetened the deal a little by adding a second server to the mix (from George). When it came time to judge and announce the winners, I had to do so with my own poem … which killed me because I hadn’t written a poem in years.

My inbox laden
Server Poets bring me pride
Rewards were doubled

There once was a SLayer named Bradley
Whose poem was flattering badly
He said 3BFL
We said ‘Oh, What the Hell’
And gave him a server quite gladly

Among numerous entries we found
That nerdy rhymes and rhymers abound
And so many came forth
Our hand was quite forced
So to the contest more servers were bound

Thus also a Slayer named Hemsell
Was chosen to leave with a morsel
Wash the zeros away
Rip and store CDs today
Make this sad server sing loud and fell

With generous swagger Karidis did add
A prize sure to make the cable co mad
For Scott Thompson’s poem
Was moving and solemn
An Apple TV should not make him sad

And finally the team of Hannon and Chong
Grammar and spelling and format all wrong
But their desire so true
And coding poetry new
Request will be supported so strong

Translation:

Server Winner: Bradley Johnson

One, two, three bar life
Free drink, free shirt, free server
Movie files need home

Server Winner: David Hemsell

CDs sit offline
Once proud server is no more
Fill barren zeros

Apple TV Winner: Scott Thompson

Your free server will
fail to bring much joy to me
I use Macintosh

Additional Computer-Related Award of Some Kind: Chong and Harold

import com.softlayer.server;
public class freeAssetReserver{
   int count = 0;
   String you = “hero”;
   function void vmBoxOursObserver();
}

Congratulations to Bradley and David for winning the servers and to Scott Thompson for walking away with the unadvertised Apple TV! When we were going through the submissions, we couldn’t help but reward the submission from Chong and Harold – A coding limerick!

We’ll post more of the submissions in the comments on this post, so be sure to scroll down and add your own!

-Duke

April 7, 2011

Thou Shalt Transcode

By in Development, SoftLayer, Tips and Tricks

Deep in the depths of an ancient tomb of the great Abswalli, you and your team accidentally awaken the Terbshianaki ghost army. You’re disconnected from the supply caravan with the valuable resources that could not only sustain your journey but also save your team. As Zeliagh the Protesiann hunter fires his last arrow, you come to the sudden realization that continuing your quest is now hopeless. Alas, true terror was unknown before this moment as you come to the most surprising realization: The one thing you truly can’t live without is your trusty server that converts one type of media into another.

Fear not great adventurer, for I, Phil of the SLAPI, have come, and I bear the gifts of empowerment, automation and integration. Freedom from the horror of your epiphany can be found in our complementary media transcoding service.
Before we can begin, some preparation is required. First, you must venture to our customer portal and create a transcoding user: Private Network->Transcoding. As you know from the use of your other SoftLayer spoils, you shan’t be obligated to access this functionality from your web browser. You can summon the API wizardry bequeathed to you by coders of old in the the SLDN scroll: SoftLayer_Network_Media_Transcode_Account::createTranscodeAccount.*

*For the sake of this blog, we’ll abbreviate “SoftLayer_Network_Media_Transcode_Account” as “SNMTA” from here forward … Shortening it helps with blog formatting.

You must then construct an object to represent a SoftLayer Network Media Transcode Job, like our SoftLayer Network Media Transcode Job template object. This template object will be built with a number of properties. Your pursuit in relieving your aforementioned horror only necessitates the use of the required properties.

You will need to decide in which format the final treasure will take form. You may find this information with the SNMTA::getPresets method.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$client = SoftLayer_SoapClient::getClient('SoftLayer_Network_Media_Transcode_Account', $trandcodeAccountId, $apiUsername, $apiKey);
$transcodePresets = $client->getPresets();
print_r($transcodePresets);
Array
(
    [0] => stdClass Object
        (
            [GUID] => {9C3716B9-C931-4873-9FD1-03A17B0D3350}
            [category] => Application Specific
            [description] => MPEG2, Roku playback, 1920 x 1080, Interlaced, 29.97fps, 25Mbps, used with Component/VGA connection.
            [name] => MPEG2 - Roku - 1080i
        )
 
    [1] => stdClass Object
        (
            [GUID] => {03E81152-2A74-4FF3-BAD9-D1FF29973032}
            [category] => Application Specific
            [description] => MPEG2, Roku playback, 720 x 480, 29.97fps, 6.9Mbps, used with Component/S-Video connection.
            [name] => MPEG2 - Roku - 480i
        )
 
    [2] => stdClass Object
        (
            [GUID] => {75A264DB-7FBD-4976-A422-14FBB7950BD1}
            [category] => Application Specific
            [description] => MPEG2, Roku playback, 720 x 480, Progressive, 29.97fps, 6.9Mbps, used with Component/VGA connection.
            [name] => MPEG2 - Roku - 480p
        )
.....

The freedom to use this power (the more you know!) is yours, in this instance, I scrolled through let my intuition find the option which just felt right:

14
15
16
17
18
19
20
stdClass Object
	(
            [GUID] => {21A33980-5D78-4010-B4EB-6EF15F5CD69F}
            [category] => Web\Flash
            [description] =>
            [name] => FLV 1296kbps 640x480 4x3 29.97fps
        )

To decipher this language we must know the following:

  1. The GUID is the unique identifier which we will use to reference our champion
  2. The category section is used to group like presets together, this will be useful for those who’s journey leads down the path of GUI creation
  3. A description of the preset, if one is available, will be listed under description
  4. name is simply a human-readable name for our preset

You are nearly ready to restore your yearned for transcoding service as the ghostly horde presses the defensive perimeter. We have but one more task of preparation: We must provide the transcoding service a file! Using your Wand of File Transference +3, or your favorite FTP client, you enter the details for your transcode FTP account found on the Transcoding page of the IMS (or of course SNMTA::getFtpAttributes) and choose the “in” directory as the destination for your source file. Lacking no other option, you may call upon Sheshura, a fairy sprite, specializing in arcane documents for a source video file: Epic Battle

The battle rages around you, as the Wahwatarian mercenaries protect your flank. The clicking of your laptop keys twist and merge in the air around your ears only to transcend into a booming chorus of “The Flight of the Valkyries” as you near transcoding Utopia. You strike:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
//  Create a transcoding client
$client = SoftLayer_SoapClient::getClient('SoftLayer_Network_Media_Transcode_Job', null, $apiUsername, $apiKey);
 
// Define our preset GUID and filename
$presetGUID = '{95861D24-9DF5-405E-A130-A40C6637332D}';
$inputFile = 'video.mov';
 
/*
 * The transcoding service will append the new file extension to the output file
 * so we strip the extension here.
 */
$outputFile = substr($inputFile, 0, strrpos($inputFile, '.'));
 
try {
    // Create a SoftLayer_Network_Media_Transcode_Job template object with the required properties
    $transcodeJob = new stdClass();
    $transcodeJob->transcodePresetGuid = $presetGUID;
    $transcodeJob->inputFile = "/in/$inputFile";
    $transcodeJob->outputFile = "/out/$outputFile";
 
    // Call createObject() with our template object as a parameter
    $result = $client->createObject($transcodeJob);
    // $result will contain a SoftLayer_Network_Media_Transcode_Job object
    print_r($result);
} catch ( Exception $e) {
    die( $e->getMessage());
}

If your will did not waver nor did your focus break in the face of ever-closing ghouls pounding your resolve, your treasure will be waiting. Brandish your Wand of File Transference +3, or utilize your favorite FTP client to retrieve your reward: “out/video.flv”

If the gods be with thee, your resulting file should look like this: Epic Battle (in .flv)

With your victory fresh upon the tablets of history, you can now encode to any of our supported formats. Try using the process above to convert the video to .mp4 format so your resulting file output is Epic Battle (in .mp4)!

-Phil

P.S. If you’re going to take off your training wheels, the second example uses “[description] => MPEG4 file, 320x240, 15fps, 256kbps for download” for the bandwidth impaired.

March 1, 2011

API Basics: REST API – “Hello World”

By in SoftLayer, Technology, Tips and Tricks

Learning SoftLayer’s API
When I first started to look at SoftLayer’s API, I favored the SOAP programming interface because I liked the strictly formatted XML responses, the good separation of concerns (using the server as proxy for data retrieval) and the increased security. All of these are great reasons to use the SOAP interface, but once I saw how easy and direct the REST interface is, I decided that I would use it as my cornerstone for learning the SoftLayer API.

REST API
Although the REST software archetype is a difficult concept to explain, its practice has become natural to those of us who use the internet daily. Imagine that the information that you want to know is saved as a web page somewhere and all you have to do is type in the URL, it will prompt you for a username and password, and you will see the information that you requested.

Authentication
Before making a request you will need to find your API authentication token. To do this, log into your customer account and click API under the Support tab. Click the “Manage API Access” link. At the bottom of the next page you will see a drop-down menu that says “Select a User” and above it a tag that says “Generate a new API access key.” Select a user and click the “Generate API Key” button. You will see your username and the generated API key for that user. Copy this API key, as you’ll need it to send commands SoftLayer’s API.

“Hello World”
Unfortunately, there is no specific “Hello World” command in SoftLayer’s API, but there are some commands that are very simple and don’t require any variables, like the getObject() method. APIs are like component libraries, split into web services and methods of that service. The SLDN has a full list of SoftLayer’s web services to choose from. I am going to use the getObject() method from the SoftLayer_Account service in this example:

https://api.softlayer.com/rest/v3/SoftLayer_Account.xml

  • You will be prompted for your username and API access key
  • XML data type output

https://USERNAME:PASSWORD@api.softlayer.com/rest/v3/SoftLayer_Account.json

  • Automatic authentication
  • JSON data type output

The Request
Here is the basic REST request structure:

https://username:API key@api.service.softlayer.com/rest/v3/serviceName/InitializationParameter.returnDatatype
  • All requests are sent via secure transfer (https://)
  • Listing your username and API key before the URL allows for automatic HTTP authentication
  • Service and serviceName both refer to the web service you are trying to access
  • InitializationParameter is only used if the method you are calling requires an initialization Parameter
  • SoftLayer’s REST API can respond with either JSON or XML data types; replace returnDatatype with the type you would like to receive.

The Data
Looking at the first link above, your browser should be able to output the response data in XML format, showing information about your account. More information about the format of the data can be found on the SLDN wiki.

REST Basics
When you start integrating this into a website you will want to get/make a function or library to handle advanced requests and to properly receive and disperse the response; I recommend using JQuery. This is the most basic example of a function call for SoftLayer’s API, I hope that it will help you get a feel for the information that you will need to pass to our server and the kind of response that you will receive.

-Kevin

February 14, 2011

The Black Cat

By in Development, SoftLayer

“Dogma.” “Religion.” What comes to mind when you hear these words? In the real world, you might think of Christianity, Islam, or Judaism. In the political world, you might think of Communism vs. Freedom. Closer to home, you might think of “red state” and “blue state.”

Computers are deterministic, logical machines, yet they too have all the trappings of the world’s major religions and dogmas. The desktop world is dominated by Microsoft and Apple to use the religion metaphor. All computing worlds could be broken down into “proprietary” and “open source” if we are talking about dogma.

Relevant to this discussion, the web development world has three major religions in those two dogmas: Microsoft’s ASP.NET, the PHP world, and the Java world. My platform of choice has always been ASP.NET.

I am pretty solid in my reasons for preferring it over all others, and also pretty clear about the accidental reasons I found myself in this camp. Much how someone born into a particular religion is likely to freely adopt it at some point, I too ended up adopting ASP.NET for reasons that were nothing more than accidental.

I consider myself a ‘citizen of the world’ in more ways than one, and the opportunity to work at SoftLayer was an opportunity I couldn’t turn down. I had to check my biases at the door, open my mind, and see how this side of the aisle does business. (And as if to remind me that a dogmatic shift has occurred in my professional life, Fox News continues to greet me every morning at the top of the stairs.)

To admit just some of my biases: How on earth did you build an enterprise-grade portal with a weakly typed language that doesn’t require something as basic as a compiler? More importantly: Why? How does one work with such a thing? Some of you still use VI?? Seriously?

Fast forward about six months — just enough to say I am “proficient” in PHP and to have an exposure to the database side of things. The journey and rants are long and technical, but it should come as no surprise that I still prefer the Microsoft ecosystem over one based on PHP. I find it easier to work with, faster, and less error-prone than the alternative. The language is more structured, the tooling is better, and the framework better established and developer-oriented.

Humor me with this for a moment.

Assume for the sake of argument that my belief is correct — that Microsoft’s offerings are indeed better than PHP’s on every metric a developer can measure. If this is true, one might reasonably conclude that SoftLayer erred in its choice of development platform. Even though I will be the first to evangelize the virtues of the Microsoft ecosystem, I’ll also be the first to say that this conclusion is wrong.

The conclusion is wrong because in asking the “Why?” in “Why SoftLayer chose the platform it did,” I approached the question from the perspective of what’s best for the developer. The question should have instead been phrased as: “What does SoftLayer’s choice of platform say about our core values?

It isn’t exactly open source. Place the source code on any laptop, and you’ll get the modern-day equivalent of summary execution: You will be fired.

It isn’t developer convenience. It isn’t needed. From what I’ve seen here, the developers have used their tools in a more extensive and architecturally correct way than I have in my time in the ASP.NET ecosystem.

The elusive answer can be summed up in one word: Independence. Fierce independence if you’re into using superlatives.

While the Microsoft ecosystem may be the easiest on developers, it comes at price. Microsoft’s ultimate responsibility is to the thousands of people that use its tools, so it has to steer its platforms in a way that fit the disparate needs of the many developers who rely on them. In relying on its own software, built on open-source offerings, SoftLayer can steer its platform in a way that benefits SoftLayer … It has only its own needs to consider.

The soundness of this reality — and indeed, the necessity of being fully independent when one’s core offering is the basic infrastructure that runs people’s businesses should be obvious.

Very often we become overprotective of our dogmas, and fear that which we do not fully understand. To that end, I try to remember the words of an unlikely capitalist: “It doesn’t matter if a cat is black or white, so long as it catches mice.

-George

January 12, 2011

‘What\’s with These “Quote” Things?’

By in Development, SoftLayer, Tips and Tricks

‘We\’ve’ . “all $een” . ‘this’ . $problem . ‘before’ . $and->it . ((1==1) ? ‘seems’ : ‘dosen\’t seem’) . sprintf(‘about time to %s things’, ‘clarify’);

PHP string handling can be a tough concept to wrangle. Developers have many options: single / double quotes, concatenation and various string manipulation functions. The choices you make have a significant impact on the readability and performance of your script. Let’s meet the line-up:

The Literal
Single quotes are used to define a string whose contents should be taken literally. What this means is that PHP will not attempt to expand any content contained between the ' '.

This is the way to tell your favorite Hypertext Preprocessor, “That little guy? Don’t worry about that little guy.”

In most cases this is the de-facto standard for strings. However, when a decent number of variables become involved it tends to become difficult to keep your quotes accounted for. When combining simple strings with variables and single quotes, the “.” operator is needed between each variable/string. That “.” is known as the concatenation operator.

Input:
$date = 'Yesterday';
$location = 'outside';
$item = array ( 'description' => 'lovely', 'name' => 'butterfly');
$content = $date . ' I went ' . $location . ' and caught a ' . $item['description'] . ' ' . $item['name'];

Output: Yesterday I went outside and caught a lovely butterfly

The Interpreted
Using double quotes will cause PHP to look a little closer into the string to find anywhere it can “read between the lines.” Variables and escape characters will be expanded, so you can reference them inline without the need for concatenation. This can be useful when creating strings which include pre-defined variables.

Input:
$file = 'example.jpg'
$content = "<a href=\"http://www.example.com/$file\">$file</a>"

Output: <a href=”http://www.example.com/example.jpg”>example.jpg</a>

In previous versions of PHP there was a significant performance difference between the use of single v. double quotes. In later versions performance variations are negligible. The decision of one over the other should focus on feature and readability concerns.

The Thoughtful
Unlike single and double quotes, the sprintf function comes to the table with a few cards up its sleeve. When provided with a formatting “template” and arguments, sprintf will return a formatted string.

Input:
$order = array ( 'item' => 'RC Helicopters', 'status' => 'pending');
$content = sprintf('Your order of %s is currently %s', $order['item'], $order['status']);

Output: Your order of RC Helicopters is currently pending

When constructing a complex string such as XML documents, sprintf allows the developer to view the string with placeholders rather than a mish-mash of escaped quotes and variables. In addition sprintf is able to specify the type of variable, change padding/text alignment, and even change the order in which it displays the variables.

The debate over the most efficient method of string definition has raged for years and will likely continue ad infinitum. However, when the benchmarks show their performance as almost identical, it leaves you with one major question: What works the best for your implementation? Typically my scripts will contain all of the methods above, and often a combination of them.

print(sprintf('The %s important thing is that %s give them all a try and see for %s', 'most', 'you', 'yourself'));

-Phil

October 22, 2010

Microsoft Windows 7 Goes Mobile

By in Executive Blog, News, Technology

On October 11, our friends at Microsoft unveiled what promises to be the first in a long series of devices that will be powered by the newly minted Windows Mobile 7 operating system.

From a device perspective, they look familiar to what we currently get from Apple and Google Android powered devices. Each device features a relatively large touch screen, and a number of on-board applications that let you send and receive phone calls, send email, listen to music, watch videos and browse the internet. In addition, Microsoft offers the promise of the Marketplace Hub – here you can download other applications and games to the device.

The great thing about all of this is the potential impact on SoftLayer. The success of both Apple and Google’s Android OS (which is found on a number of different vendors including HTC, LG, Lenovo, Samsung and others) is due to a lot of factors. What is certain is that one of those factors has been the birth of a developer community that feeds all sorts of wild and wonderful applications to the Apple App Store and the Android Market. It is amazing how many people will pay $2.00 to hurl a bunch of fowl at pigs…make no mistake, this is a lucrative marketplace.

It goes without saying that SoftLayer has a bunch of app developers as clients. Our ability to quickly scale combined with a network architecture that can take whatever is thrown at it makes us a great partner. Not only do we host a number of test and development environments, but we also host a number of the live applications that are getting pushed out to end users. The addition of a robust Microsoft powered device to the family means a few things for us:

  1. A number of companies will begin to work on porting games/apps to Microsoft Mobile 7. (We have already started)
  2. A new flock of developers will arrive that are focused on Microsoft Mobile 7 apps. They will start there and consider porting to Apple and Android environments if they are successful.
  3. Once the test and development work has been completed, it will be time to put those new apps in the hands of a bunch of eager consumers.

As far as I can tell, everything points to more SoftLayer! And the world needs more SoftLayer. So, on that note, let’s me take the opportunity to wish Microsoft terrific success with the new mobile OS. After all, a rising tide raises all ships!

-@quigleymar

May 27, 2010

Here I sit

By in Executive Blog, Social Media, SoftLayer

So here I sit broken hearted, oh wait wrong story. Here I sit at the booth at GDC in Vancouver Canada in a traffic lull. There must be a good speaker talking at the moment. It gives me a moment to tell you about the refreshing “youth” of this industry. At this show people get it, they understand the model. This isn’t the largest show we will go to and might not sell a million servers but we are still getting the word out that outsourcing the hard stuff and letting people focus on what they do best is a great thing. Game developers don’t want to waste a day or two setting up a server they would rather be making their game. It’s also interesting listening to the students of game development at this show; I am learning what is going into the next big game. Here it is in a nutshell. You start with Zombies, and then have zombie riots where zombies kill some people and then you have the zombies take over the world and then you have a new breed of zombies that kill and eat the existing zombies. There you have it, the next big game! I want royalties. So for all you game lovers out there this is the place where it all begins and SoftLayer is doing everything we can to make sure these developers have the free time to make the next killer app. You can thank us anytime! And who knows maybe one of these guys will buy a million servers!

March 18, 2009

Code Performance Matters Again

By in Technology

With the advent of cloud computing, processing power is coming under the microscope more and more. Last year, you could just buy a 16-core system and be done with it, for the most part. If your code was a little inefficient, the load would be high, there really wasn’t a problem. For most developers, it’s not like you’re writing digg and need to make sure you can handle a million page requests a day. So what if your site is a little inefficient, right?

Well think again. Now you’re putting your site on “the cloud” that you’ve heard so much about. On the cloud, each processor cycle costs money. Google AppEngine charges by the CPU core hour, as does Mosso. The more wasted cycles in your code, the more it will cost to run it per operation. If your code uses a custom sorting function, and you went with bubble sort because “it was only 50 milliseconds slower than merge sort and I can’t be bothered to write merge sort by hand” then be prepared for the added cost over a month’s worth of page requests. Each second of extraneous CPU time at 50,000 page views per day costs 417 HOURS of CPU time per month.

Big-O notation hasn’t really been important for the majority of programmers for the last 10 to 15 years or so. Loop unrolling, extra checks, junk variables floating around in your code, all of that stuff would just average out to “good enough” speeds once the final product was in place. Unless you’re working on the Quake engine, any change that would shave off less than 200ms probably isn’t worth the time it would take to re-engineer the code. Now, though, you have to think a lot harder about the cost of your inefficient code.

Developers who have been used to having a near-infinite supply of open CPU cycles need to re-think their approach to programming large or complex systems. You’ve been paying for public bandwidth for a long time, and it’s time to think about CPU the same manner. You have a limited amount of “total CPU” that you can use per month before the AppEngine’s limits kick in and you begin getting charged for it. If you’re using a different host, your bill will simply go up. You need to treat this sort of thing like you would bandwidth. Minimize your access to the CPU just like you’d minimize access to the public internet, and keep your memory profiles low.

The problem with this approach is that the entire programming profession has been moving away from concentrating on individual CPU cycles. Helper classes, template libraries, enormous include files with rarely-used functions; they all contribute to the CPU and memory glut of the modern application. We, as an industry, are going to need to cut back on that. You see some strides toward this with the advent of dynamic include functions and libraries that wait to parse an include file until that object or function is actually used by the execution of the program for the first time. However, that’s only the first step. If you’re going to be living on the cloud, cutting down on the number of times you access your libraries isn’t good enough. You need to cut down on the computational complexities of the libraries themselves. No more complex database queries to find a unique ID before you insert. No more custom hashing functions that take 300 cycles per character. No more rolling your own sorting functions. And certainly no more doing things in code that should be done in a database query.

Really good programmers are going to become more valuable than they already are once management realizes that they’re paying for CPU cycles, not just “a server.” When you can monetize your code efficiency, you’ll have that much more leverage with managers and in job interviews. I wouldn’t be surprised if, in the near future, an interviewer asked about cost algorithms as an analogy for efficiency. I also wouldn’t be surprised if database strategy changed in the face of charging per CPU cycle. We’ve all (hopefully) been trying for third normal form on our databases, but JOINs take up a lot of CPU cycles. You may see websites in the near future that run off large denormalized tables that are updated every evening.

So take advantage of the cloud for your computing needs, but remember that it’s an entirely different beast. Code efficiency is more important in these new times. Luckily, “web 2.0″ has given us one good tool to decrease our CPU times. AJAX, combined with client-side JavaScript, allows a web developer to generate a web tool where the server does little more than fetch the proper data and return it. Searching, sorting, and paging can all be done on the client side given a well designed application. By moving a lot of the “busy work” to the client, you can save a lot of CPU cycles on the server.

For all those application developers out there, who don’t have a client to execute some code for you, you’re just going to have to learn to write more efficiently I guess. Sorry.

-Daniel