Thursday, October 01, 2009

A simple load test in Terracotta...

This is a response to the following blog in which the author wrote a micro-benchmark and got some pretty bad results using Terracotta http://zion-city.blogspot.com/2009/10/terracotta-as-distributed-dbms-bad-idea.html.

Since the commenting system on blogger doesn't allow code, I am posting the response on my blog with code attached for reference.

So my approach was to try replicate the author's implementation, to see what kind of performance a straightforward micro-benchmark might achieve.

Reader beware - micro-benchmarks are never a good idea, and not usually indicative of real-world performance. In this case, based on real-world results I have seen, my results appear to be a lower bound for the kind of performance one should expect since the test isn't concurrent and is running on a single machine - hardly the kind of environment a real world clustered app would exist in)

So, with that said, I wrote a simple load test against a ConcurrentHashMap, and put 100,000 objects into it.

My results show:
Avg TPS: ~3,000
Instantaneous TPS as high as: ~7,000

Here's the code:

import java.util.Date;
import java.util.Map;
import java.util.concurrent.*;

public class Main
{
static Map<Integer, Foo> map =
new ConcurrentHashMap<Integer, Foo>();

public static class Foo
{
public String name;
public String name2;
public String name3;

public Foo(String name)
{
this.name = name;
this.name2 = name + " 2";
this.name3 = name + " 3";
}
}

public static void main(String[] args)
{
long start = System.currentTimeMillis();

for (int i = 0; i < 100000; i++) {
map.put(i, new Foo(new Date().toString()));
}
System.out.println("elapsed: " + (System.currentTimeMillis() - start));
}
}


And here's the tc-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<tc:tc-config xmlns:tc="http://www.terracotta.org/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-5.xsd">
<application>
<dso>
<instrumented-classes>
<include>
<class-expression>Main$Foo</class-expression>
</include>
</instrumented-classes>
<roots>
<root>
<field-name>Main.map</field-name>
</root>
</roots>
</dso>
</application>
</tc:tc-config>


I took a screenshot of the dev console running during the test, to give you an idea of the instantaneous TPS achieved:

13 comments:

cool said...

租辦公室租店面買辦公室店面租賃店面出租店面出售花茶花草茶養生茶招牌led招牌招牌製作美國月子中心保養美國月子中心OBU投審會會計師事務所會計師工商登記公司登記包子肉粽宅配美食四神湯搬家公司訂房訂房網花東旅遊桃園土地桃園房屋仲介桃園房屋桃園房屋網桃園房屋買賣漆彈搬家公司會場設計展場設計會場設計展場設計展覽設計消防設備消防設備機電崴立機電消防公司地板施工超耐磨地板店面出租乳癌全身健康檢查肝癌健康檢查身體檢查飛梭雷射雷射溶脂直航機票自由行三久太陽能三久太陽能太陽能熱水器別墅外觀設計環保袋別墅外觀設計室內裝修電波拉皮hand dryer電波拉皮雷射溶脂肉毒桿菌系統家具台中漆彈場漆彈團體服美國月子中心團體服

cool said...

團體服團體服T恤圍裙POLO衫班服團體服創意熱轉印團體服訂做宜蘭民宿關鍵字廣告seo網路廣告網路行銷seo網站設計seo線上客服seo網頁設計seo網頁設計公司網路行銷網路行銷桃園室內設計室內設計作品室內裝潢裝潢室內設計室內設計公司裝潢設計豪宅空間設計店面設計豪宅設計桃園室內設計公司別墅外觀設計室內裝潢設計台北室內設計新竹室內設計法拍屋中古車二手車環保袋環保袋肉毒桿菌健檢醫學美容淨膚雷射汽車美容法拍屋水餃清潔公司實驗動物到府坐月子坐月子坐月子中心坐月子餐孕婦月子餐到府坐月子坐月子坐月子中心坐月子中心台中坐月子中心台北月子餐月子中心坐月子餐月子餐外送

cool said...

月子餐食譜找工作統一發票7 8月求職1111求職人力銀行104求職人力銀行104人力銀行統一發票5 6月104人力銀行104求職人力銀行塑膠袋統一發票1 2月塑膠袋批發塑膠袋工廠金價黃金價格統一發票3 4月1111人力銀行1111人力銀行求職黃金價格查詢中古車買賣塑膠袋統一發票3 4月塑膠袋批發中古車中古車買賣台北人力銀行金價查詢sum中古車中古車貸款信用貸款房屋貸款剖腹生產 命理網 姓名學 姓名配對 星座 星座運勢 算命 開運印章 風水 外遇 徵信 徵信社 外遇 徵信 徵信社 外遇 徵信 徵信社 外遇 徵信 徵信社 外遇 徵信 徵信社 外遇 徵信 徵信社 搬家公司 搬家公司 台北搬家公司 新竹搬家公司

haha said...

Nice BLOG.................................................

pbsl said...

you have a nice site.thanks for sharing this site. various kinds of ebooks are available here

http://feboook.blogspot.com

LAN said...

puma mens shoes
puma shoes
puma speed
nike shoes
nike air
nike air shoes
nike air max 90
nike air max 95
nike air max tn
nike air rift
nike shox r4
nike air max 360
nike shox nz
puma cat
air max trainers
mens nike air max
sports shoes
nike air rifts
nike air rift trainer
nike air
nike shoes air max
nike shoes shox
air shoes
nike shoe cart
puma future
cheap puma
nike rift
jeans shop
diesel jeans
levis jeans
nike rift shoes
cheap nike air rifts
bape shoes

smallawei said...

性感睡衣,情趣睡衣,性感內衣褲,性感內衣,性感內褲,
性感貓裝,性感睡衣,貓裝,吊帶襪,情趣內褲,丁字褲,SM,

震動環,潤滑液,情趣禮物,情趣玩具,威而柔,精油,逼真按摩棒,數位按摩棒,


G點,按摩棒,轉珠按摩棒,變頻跳蛋,跳蛋,無線跳蛋,

飛機杯,男用強精長軟質套,男用強精短軟質套,充氣娃娃性感內褲,
自慰套,自慰套,情趣娃娃,自慰器,電動自慰器,充氣娃娃,
角色扮演,情趣,情趣用品,巴黎,
情趣用品,情趣,

air shoes said...

I like your blog. Thank you. They are really great .
Some new style Puma Cat shoes is in fashion this year.
The Nike Air Shoes is a best Air Shoes .
Nike Air Rift is good and Cheap Nike Shoes.
If you are a fans of Puma basket,we would offer the good and Cheap Puma Shoes for you .the cheap ugg bootsis best christmas gift now.
The information age is really convenient .

Böcek ilaçlama said...

fare ilaçlama
fare ilaçlama
fare ilaçlama
fare ilaçlama
fare ilaçlama
fare ilaçlama
fare ilaçlama

haşere ilaçlama
haşere ilaçlama
haşere ilaçlama

pire ilaçlama
pire ilaçlama
pire ilaçlama
pire ilaçlama
pire ilaçlama
pire ilaçlama

bit
seo
fare ilaçlama

bit ilaçlama
bit ilaçlama
bit ilaçlama
bit ilaçlama
bit ilaçlama
bit ilaçlama

akrep ilaçlama
akrep ilaçlama
akrep ilaçlama
akrep ilaçlama
akrep ilaçlama

ömer said...

Yıldız ilaçlama kurulduğu andan beri profesyonel pire ilaçlama hizmeti sunmaktadır. Sizde sitenize seo yaptırmak istiyorsanız firmamızla iletişime geçiniz.

Nike shox shoes said...

As to which more appropriate oneself, water like the person, changes in temperature from cicada.

Nike shox shoes can surely not let you down,romance yourself with nike shox

aa said...

As I write this post—longhandOffice 2010in a spiral notebook—I’m 20,000 feet above eastern Washington, having Microsoft Office 2010just crossed above the Cascades on my return flight Microsoft wordto Chicago. I visited Seattle for the weekend to Office 2007and I have known each other for 20 years now. They Microsoft Officehad a lovely ceremony, and the trip in general was fantastic.Microsoft Office 2007In the 13 years since I left Seattle, I’ve Office 2007 keyvisited six or seven times, and I always return to wherever has Office 2007 downloadOffice 2007 Professionalbecome home with mixed feelings about the place. It Outlook 2010both alarms and pleases me to see howMicrosoft outlookthat once-familiar areas seem almost foreign. ForMicrosoft outlook 2010neighborhoods have changed, to the point Windows 7 as have cookie-cutter, here-today-and-gone-tomorrow nightclubs that cater to the shiny shirt crowd.

Sahin said...

thank you very much fırsat prada shoes prada sneakers