Monthly Archives: December 2010

[BenchMark] ActiveMQ의 성능에 대해서

최근에 ActiveMQ를 써 볼일이 생겼는데, 기대한 것 보다 성능이 너무 안나와서

좌절하고 있습니다.
일단 기본적인 Persistant 나 VMCursor 를 조절해도 속도가 변경될 여지를 안보이네요.
그래서 결국 간단한 프로그램을 만들어서 돌려봤는데
사양: vCore 8개
메모리: 16G(이중 JVM에는 1G 할당)
최초에 하나의 단일 Producer 로 동작할 때는(TSimpleServer)
초당 -_- 250 tps 정도
현재 앞단이 thrift 인데 이게 느려서 그럴 수도 있지만 -_- 그래도 성능이 T.T
다시 멀티 스레드로 ConnectionPool을 만들어서 테스트 하니(TNonblockingServer)
스레드 5개~20개로 늘려도
대략  초당 370 tps 거의 50% 성능 향상이지만, -_- 전혀 도움이 안되는 쿨럭…
물론, ActiveMQ 설정이 제대로 안된거고, 내가 성능을 못쓰는 형태로 구현한거
같긴한데 아직 확인해볼 부분이 많이 필요할듯 하다 -_-

hadoop 0.21 설치 방법

1. hadoop download

2. hadoop 압축 풀기
3. 각 서버들에 ssh 연결 설정 만들기
 
 1)namenode 로 사용할 서버에서
  ssh-keygen -t rsa
 
 .ssh 에 생성될 파일중에 id_rsa.pub 라는 파일을(공개키다)
 datanode로 사용될 파일들에 복사 .ssh 를 만들어서 authorized_keys 라는 이름으로 복사
 .ssh 는 755 로 authorized_keys 는 644

4. hadoop_env.sh 설정 다음 설정 추가

export JAVA_HOME=/usr/
export HADOOP_HOME=/home/charsyam/hadoop
export HADOOP_LOG_DIR=/data/hadoop/logs
export HADOOP_SLAVES=${HADOOP_HOME}/conf/slaves

5. master/slave 설정
master 에는 namenode 로 사용될 서버 ip
slave 에는 datanode 로 사용될 서버 ip 추가

6. core-site.xml 설정
<?xml version=”1.0″?>
<?xml-stylesheet type=”text/xsl” href=”configuration.xsl”?>

<!– Put site-specific property overrides in this file. –>

<configuration>
    <property>
        <name>webinterface.private.actions</name>
        <value>true</value>
        <description> If set to true, the web interfaces of JT and NN may contain
                actions, such as kill job, delete file, etc., that should
                not be exposed to public. Enable this option if the interfaces
                are only reachable by those who have the right authorization.
        </description>
    </property>
    <property>
        <name>fs.default.name</name>
        <value>hdfs://172.27.0.2:54310</value>
        <description></description>
    </property>
    <property>
        <name>dfs.name.dir</name>
        <value>/data/hadoop/name</value>
        <description></description>
    </property>
    <property>
        <name>dfs.data.dir</name>
        <value>/data/hadoop/data</value>
        <description></description>
    </property>
</configuration>

7. hdfs-site.xml 설정
<?xml version=”1.0″?>
<?xml-stylesheet type=”text/xsl” href=”configuration.xsl”?>

<!– Put site-specific property overrides in this file. –>

<configuration>
    <property>
        <name>dfs.name.dir</name>
        <value>/data/hadoop/name</value>
        <description></description>
    </property>
    <property>
        <name>dfs.data.dir</name>
        <value>/data/hadoop/data</value>
        <description></description>
    </property>
    <property>
        <name>hadoop.tmp.dir</name>
        <value>/data/hadoop/dfs</value>
        <description>A base for other temporary directories.</description>
    </property>
    <property>
        <name>dfs.replication</name>
        <value>3</value>
    </property>
</configuration>

8. mapred-site.xml 수정
<?xml version=”1.0″?>
<?xml-stylesheet type=”text/xsl” href=”configuration.xsl”?>

<!– Put site-specific property overrides in this file. –>

<configuration>
 <property>
  <name>mapreduce.job.tracker</name>
  <value>172.27.0.2:54311</value>
  <description></description>
 </property>
 <property>
  <name>mapreduce.jobtracker.system.dir</name>
  <value>/data/hadoop/mapreduce/system</value>
  <description></description>
 </property>
 <property>
  <name>mapreduce.cluster.local.dir</name>
  <value>/data/hadoop/mapreduce/local</value>
  <description></description>
 </property>

 <property>
  <name>mapred.tasktracker.map.tasks.maximum</name>
  <value>2</value>
  <description></description>
 </property>
 <property>
  <name>mapred.tasktracker.reduce.tasks.maximum</name>
  <value>2</value>
  <description></description>
 </property>
</configuration>

9. 모든 설정 파일을 각 서버로 복사해준다.

10. Namenode format
   bin/hadoop namenode -format
11. start-dfs.sh
12. start-mapred.sh

13. jps 로 제대로 설정되었는지 확인


pkg-config

 protobuf 를 설치하고 샘플을 빌드하는데 pkg-config 이 제대로 셋팅되지 않았다라는 메시지가

계속 나타났다 -_- 이거 왜 이럴까 T.T
 관심이 별로 없어서 신경을 안쓰던 것인데, 빌드할 때, 해당 라이브러리의 경로,
include 의 위치 빌드시 필요한 cflags, libs 등에 대한 정보를 미리 설정해둔것이다.
샘플은 다음과 같다.
prefix=/nadia
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: Protocol Buffers
Description: Google’s Data Interchange Format
Version: 2.3.0
Libs: -L${libdir} -lprotobuf  -pthread
Cflags: -I${includedir} -pthread
# Commented out because it crashes pkg-config *sigh*:
# Conflicts: protobuf-lite
이것의 장점은 빌드시에 실제 중요한 정보의 위치를 빌드 스크립트에서
    pkg-config --cflags protobuf         # print compiler flags
    pkg-config --libs protobuf           # print linker flags
    pkg-config --cflags --libs protobuf  # print both
이런 방법으로 얻어올 수 있다는 것이다. 빌드 시 실제 위치에 대한 정보를 알 필요없이
해당 정보만 셋팅해 주면 된다. 

날로 먹는 Scalable 이야기 – 아꿈사 송년회 발표

12월 18일에 있었던 아꿈사 송년회 발표 내용입니다. 대략 2~30여분 앞에서 발표했는데도, 두근 두근

하네요 ^^

발표하면서 느꼈지만, 좀 더 말을 천천히 하고, 이해하기 쉽게 말하는 연습이 필요할 것 같습니다.

TDD 2 – Search a Null-Terminated String

이게 원래 순서상으로는 앞이지만, 단순히 string search 관련 함수들의 사용법에 대한것

#include    <cstring>
#include    <gtest/gtest.h>

using namespace std;

int main( int argc, char *argv[] ){
    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}

bool is_top_level_domain( const char *url ){
    const char *tld[] = { “.com”, “.net”, “.org” };
    const char *p;

    for( int i = 0; i < 3; i++ ){
        p = strstr( url, tld[i] );
        if( p && p != url ){
            return true;
        }
    }

    return false;
}

const char *get_domain_name_from_emailaddress( const char *emailaddress ){
    const char *p = strchr( emailaddress, ‘@’ );
    return (p+1);
}

const char *get_found_emailchar_info( const char *emailaddress ){
    return strpbrk( emailaddress, “@.” );
}

TEST(unittest, is_top_level_domain_true){
    ASSERT_TRUE( is_top_level_domain(“HerbSchildt.com”) );
    ASSERT_TRUE( is_top_level_domain(“Apache.org”) );
}

TEST(unittest, is_top_level_domain_false){
    ASSERT_FALSE( is_top_level_domain(“HerbSchildt.co.kr”) );
    ASSERT_FALSE( is_top_level_domain(“.com”) );
}

TEST(unittest, get_domain_name_true){
    const char *p = get_domain_name_from_emailaddress( “Herb@herbSchildt.com” );
    ASSERT_STRCASEEQ( “herbSchildt.com”, (p) );
}

TEST(unittest, get_domain_name_false){
    const char *p = get_domain_name_from_emailaddress( “Herb@” );
    ASSERT_TRUE( 0 == *p );
}

TEST(unittest, get_found_info_ok){
    const char *p = get_found_emailchar_info( “Herb@herbSchildt.com”);
    ASSERT_TRUE( p != NULL );
}

TEST(unittest, get_found_info_ok2){
    const char *p = get_found_emailchar_info( “HerbherbSchildt.com”);
    ASSERT_TRUE( p != NULL );
}

TEST(unittest, get_found_info_fail){
    const char *p = get_found_emailchar_info( “HerbherbSchildtcom”);
    ASSERT_FALSE( p != NULL );
}

Follow

Get every new post delivered to your Inbox.

Join 29 other followers