Below is list of results collected with netperf. The interesting value is TCP_CRR, it measures how fast it can TCP connect/request/response/receive. In short, the transaction rate. The test is used to simulate a normal HTTP/1.0 transaction. What's worrying is that this value has very low on Xen virtualized guests. Performance differences between bare metal and virtualization has been as high as 2-3x.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Monkey patching with redis-py didn't work out so well | |
#from gevent import monkey; monkey.patch_all() | |
import gevent | |
import redis | |
import time | |
import random | |
client = redis.Redis(host='localhost', port=6379, db=0) | |
client.flushdb() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Monkey patching with redis-py didn't work out so well | |
#from gevent import monkey; monkey.patch_all() | |
import gevent | |
import redis | |
import time | |
import random | |
client = redis.Redis(host='localhost', port=6379, db=0) | |
client.flushdb() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bp = require('beaconpush'); | |
// Create a new client | |
var beaconpush = new bp.Client('<your-api-key>', '<your-secret-key>'); | |
// Get number of users currently connected to your site | |
beaconpush.usersConnected(function (numConnected) { | |
console.log('There are ' + numConnected + ' users online'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
public class TestArrayIteration { | |
public static void testArray() { | |
Integer[] arr = new Integer[1000]; | |
for (int i = 0; i < 1000; i++) { | |
arr[i] = 1; | |
} | |
int total = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StringTokenizer { | |
public static String[] tokenize(String string, char delimiter) { | |
String[] temp = new String[(string.length() / 2) + 1]; | |
int wordCount = 0; | |
int i = 0; | |
int j = string.indexOf(delimiter); | |
while( j >= 0) { | |
temp[wordCount++] = string.substring(i, j); | |
i = j + 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (){ | |
/*! | |
* jQuery JavaScript Library v1.6.2 | |
* http://jquery.com/ | |
* | |
* Copyright 2011, John Resig | |
* Dual licensed under the MIT or GPL Version 2 licenses. | |
* http://jquery.org/license | |
* | |
* Includes Sizzle.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Naive implementation of an activity stream service using Cassandra. | |
# Just a proof of concept and not anything that is for production use. | |
# Probably flawed in many ways like proper key usage, writing and features. | |
import pycassa | |
import datetime | |
import uuid | |
pool = pycassa.connect('Actstream') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jboss.netty.channel.*; | |
import org.jboss.netty.util.HashedWheelTimer; | |
import org.jboss.netty.util.Timeout; | |
import org.jboss.netty.util.Timer; | |
import org.jboss.netty.util.TimerTask; | |
import java.util.concurrent.TimeUnit; | |
/** | |
* Simulates latency of Netty events |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Prints usage for Route 53 for a given time period | |
(exported from the Amazon Route 53 usage console). | |
""" | |
import csv | |
route53_reader = csv.reader(open('route_53_usage_february_2012.csv', 'rb'), delimiter=',', quotechar='|') | |
route53_reader.next() # Skip header | |
zone_lookup = dict('INSERT_ZONE_ID'='mydomain.com') |