Thursday, December 26, 2013

JSON Performance

I have some code that processes tweets, about 5 million a day, in realtime. They are currently stored in mongodb and also posted on various celery/rabbitmq work queues. The average message size is 5524, so encoding and decoding these messages is an issue.

Using the following test code below.




Standard Tweet message Encode/Decode with python built-in json package.

message size
TestMsg SizeDe-serializeObj SizeSerialize
cjosn, bson, ujson
StorageStoroge Cost
Empty object4114.790, 37.565, 0.970546.341, 41.856, 1.2492050Mb0.21{}
Empty list4115.069, 38.021, 1.005546.675, 41.475, 1.4002050Mb0.21[]
Object of objects843107.750, 145.440, 25.525322663.555, 828.235, 28.05142150Mb4.21
List of lists56358.805, 81.950, 16.96010443.426, 815.965, 18.31128150Mb2.81
Object with only tweet id9325.030, 53.360, 2.28042223.570, 83.445, 3.2954650Mb0.47
Full tweet message4386697.221, 867.780, 188.56012606360.290, 5847.335, 201.610219300Mb21.93https://gist.github.com/thanos/adf7e20b5f00551a38a8
Message with string payload4899446.661, 489.455, 82.3619170104.254, 327.455, 92.460244950Mb24.50
Object where the field names are codes4396422.220, 456.184, 75.035788073.345, 231.071, 81.570219800Mb21.98
Only fields of interest1911285.840, 375.440, 74.1007290147.895, 2252.359, 78.49595550Mb9.55https://gist.github.com/thanos/adf7e20b5f00551a38a8
Only fields of interest, keys encoded1660288.585, 378.330, 67.4007290143.045, 2246.330, 70.94083000Mb8.30
Denormalized Tweet4707603.030, 716.414, 186.3009246350.465, 5802.315, 198.150235350Mb23.54
Denormalized Tweet with only needed fields2158255.200, 318.004, 77.0406378142.004, 2165.425, 71.850107900Mb10.79
Denormalized Tweet with only needed fields, keys encoded1734242.375, 305.970, 65.6896378133.420, 2165.465, 68.73086700Mb8.67
Possilble Candidate1911291.691, 380.090, 74.7417290156.535, 2258.445, 77.69695550Mb9.55






Source code of test script


Empty object

{}

Empty list

[]

Object of objects

List of lists

Object with only tweet id


Full tweet message

Message with string payload


Object where the field names are codes


Only fields of interest

Denormalized Tweet


Denormalized Tweet with only needed fields


Denormalized Tweet with only needed fields, keys encoded


Sunday, December 15, 2013

Replacing ARRI lights

My aim is to replace my very hot ARRI lights. I've ought on ebay a  Bi-color 1500W LED Fresnel Video Spotlight Light from  Xiamen Came Photographic Equipment Co., Ltd.(http://stores.ebay.com/PhotoLight

I came with two problems 

1) It didn't have a fresnel lens as advertised. Okay I could live with this if it wasn't for problem number two:

2) The focus adjust button didn't work. I feels as if it's poped out of it's thread.

Now I'm talking to Came and hopefully they will resolve these problems. If so it will be a great light!