Spring Batch의 CommandLineJobRunner를 이용한 jar 를 실행하기 위한 스크립트를 공유한다.

http://static.springsource.org/spring-batch/reference/html/configureJob.html

 

Hudson 의 Execution Shell에 java command 쓰다가 하루 시간이 다 가므로.. 스크립트를 만들어서 쓰면 많이 편리하다. serivce project 이름, xml 파일 이름, define한 job 이름, 저장할 table의 prefix, 기타 덧붙일 스트링이 있으면 사용하기 편할 수 있다.

 

실제 사용 예)

/home/www/script/batch_start.pl -p batch_bot –j bot_collector

 

스크립트

#!/usr/bin/perl

use strict;
use Getopt::Std;

my %OPTS;
getopt('pxjtma', \%OPTS);

my $WWW_HOME = "$ENV{'WWW_HOME'}";

main();

sub main {

        if(scalar(%OPTS) < 2) {
        print STDERR "Usage : batch_start.pl  -p [project-name] -x [xmlfile] -j [jobname] -t [table_prefix]\n";
        print STDERR "ex) batch_start.pl -p batch_template -x batch_template_job.xml -j job1\n\n";
        print STDERR "Usage : batch_start.pl  -p [project-name] -j [jobname] -t [table_prefix] -a [append string]\n";
        print STDERR "ex) batch_start.pl -p batch_template -j job1 -a \"jobparam1=p1\"\n";

        exit 1;
    }

    my $project_name =  $OPTS{"p"};
    my $xml_name =      $OPTS{"x"};
    my $job_name =      $OPTS{"j"};
    my $prefix_name =   $OPTS{"t"};
    my $module_name =   $OPTS{"m"};
    my $appendstr =     $OPTS{"a"};

    # define 해야 할 곳~

    my $project_path =  "…"; 
    my $jar_name = `ls $project_path| grep $project_name`;
   
        if ($module_name) {
            $jar_name = $module_name.".jar";       
        }

        if($xml_name) {
                $xml_name = "$xml_name";
        } else {
                $xml_name = "$job_name";
        }

        chomp($jar_name);

        my @libList = `ls $project_path/lib`;
        my $classpath_prefix = "$project_path/lib";

        print "## project_name = $project_name"."\n";
        print "## xml_file = $xml_name"."\n";
        print "## job_name = $job_name"."\n";
        print "## jar_name = $jar_name"."\n";
        print "## prefix_name = $prefix_name"."\n";
        print "## appendstr = $appendstr"."\n";

        my $classpath = "./";

        foreach my $lib_jar (@libList) {
                chomp($lib_jar);
                $classpath .= ":$classpath_prefix/$lib_jar";
        }

        chomp($appendstr);

        print "java -jar $project_path/$jar_name $xml_name $job_name $prefix_name $appendstr -classpath$..\n";
        !system("java -jar $project_path/$jar_name $xml_name $job_name $prefix_name $appendstr -classpath$classpath") or die "failure";
}

__END__

 

<java 쪽 코드>

pom.xml에 추가할 코드- jar 파일을 바로 실행하게 한다.  

<build>
  <plugins>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
     <archive>
      <index>true</index>
      <manifest>
       <mainClass>com.google.batch.ParameterJobLuancher</mainClass>
       <addClasspath>true</addClasspath>
       <classpathPrefix>lib/</classpathPrefix>
      </manifest>
     </archive>
    </configuration>
   </plugin>

...
</build>

Spring Batch의 CommandLineJobRunner 처럼 클래스를 하나 만듬

(http://www.docjar.com/html/api/org/springframework/batch/core/launch/support/CommandLineJobRunner.java.html)

 

 

 

Posted by '김용환'
,

 

(운영하면서 느낀 점..)

가상화 장비를 마구 때려 넣어서는 성능을 올릴 수 없다. 가상화 장비가 사용할 용도가 있다. IO(네트워크/파일)가 높은 곳에서는 가상화 장비가 큰 이슈가 있다. 또한  CPU를 많이 사용하는 곳(또는 격하게 메모리를 사용하는 곳)에서 가상화 장비를 쓰는 것은 적합하지 않은 것 같다..

잘못하면 스왑인/스왑아웃때문에 성능을 떨어뜨릴 수 있는 소지도 있다.

점점 가상화 솔루션이 안정화되면서 단점이 감쇄되고 있지만, 가상화 솔루션/시스템의 한계는 존재한다.

관련해서 웹의 자료가 있어서 공유한다.

 

1.

http://www.cc.iitd.ernet.in/misc/cloud/hypervisor_performance.pdf

네이티브, 젠과 하이퍼바이저를 비교한 자료

image

image

image

 

 

2.

http://www.cl.cam.ac.uk/research/srg/netos/xen/performance.html

3.

Performance impact of virtualization on web-based MORPG systemx
(http://dl.acm.org/citation.cfm?id=2095596)

http://delivery.acm.org/10.1145/2100000/2095596/p333-kohana.pdf?ip=111.91.137.68&acc=ACTIVE%20SERVICE&CFID=90606728&CFTOKEN=23074530&__acm__=1332135001_833f2b54510411dcaef329f3bb37cbb6

6. CONCLUSION
This paper described a primary investigation of our virtualized
MORPG system. By conducting experiment, we
found out that the frequent communication among web servers
for remote access is one of bottlenecks and increasing the
number of virtual CPU per a virtual machine can reduce
the latency of remote access. The average latency of cgi
with two virtual CPU is 25 % less than that with one CPU.
The number of virtual CPU for a virtual machine is a key
to improve performance.
However, the number of real CPU
is limited. Thus, we should
decrease the number of remote
access or the number of Unix processes which serves for sharing
data among web servers. The size of RAM for a virtual
machine also seems to be an important factor.
We cannot
figure out the relation between the performance and the
RAM size. It might depend on the implementation of KVM.
Further study should be needed.

 

4.

http://www.webperformance.com/library/reports/LoadTestingVirtualizationPerformance/

물리 장비

가상화 장비

Posted by '김용환'
,

 

여러 나라에서 사용하는 전화번호 처리를 위한 라이브러리가 있다.

http://code.google.com/p/libphonenumber/

Posted by '김용환'
,

 

리눅스에 자바 파일을 빌드하고 배포하는 환경에서 윈도우에서 개발환경을 가질 경우를 위해서 미리 깔끔하게 환경셋팅하는 것이 좋다.  다음 설정은 기본으로 설정..

 

* UTF-8 설정

Window->Preferences –> General –> Workspace 에서 Text file encoding 에서 Other 항목에서 UTF-8을 설정

 

* Unix Line End

Window->Preferences –> General –> Workspace 에서 New text file line delimiter 에서 Other 항목에서 Unix로 설정

 

* Formatter

미리 정한 formatter 를 공유해야 함

Posted by '김용환'
,

Git Flow 좋은 자료

Tool 2012. 3. 18. 16:21

 

민수기술의 왕수용님 자료

1. 웹 페이지

http://wangsy.com/blog/2011/12/git-guide/

git flow 는 git 의 장점인 브랜치를 적극 활용하여, 원활한 프로젝트 중 소스코드 관리를 가능하게 하고, git flow 툴을 이용하여 이러한 방법론을 손쉽게 적용하도록 도와준다.

2. pdf

http://wangsy.com/blog/wp-content/uploads/2011/11/Git-Guide-r1.pdf

 

3. Git Flow Homepage
https://github.com/nvie/gitflow

4. Short introduction about Git Flow
http://vimeo.com/16018419

http://vimeo.com/37408017

5. Git Flow Model
http://nvie.com/posts/a-successful-git-branching-model/

'Tool' 카테고리의 다른 글

[Eclipse] maven dependencies references non existing library 에러 해결  (0) 2012.05.26
[Cygwin] 한글 깨짐  (0) 2012.04.06
Synergy 를 다시 쓸 줄이야..  (0) 2012.03.16
번역기 추천  (0) 2012.03.13
Team Viewer  (0) 2012.03.08
Posted by '김용환'
,

synergy는 노트북, pc 뿐의 확장 뿐 아니라 다양한 운영체제에서의 키보드, 마우스 콘트롤을 제어할 수 있다. 
다시는 안쓸 줄 알았는데.. 반드시 출장 때문에 노트북을 주로 써야하는 상황이 되었다..

synergy-foss.org/ 

최신 버전이 이해하기도 UI가 가장 좋은 것 같다. 현재 1.4.7 beta로 이용 결정

호스트 이름이 한글이어서 먼저 영문으로 변경
http://blog.naver.com/PostView.nhn?blogId=umhyun2&logNo=70097727903&viewDate=&currentPage=1&listtype=0  
같은 네트웍이 아니면, 연결자체가 되지 않음. 클라이언트에서는 IP로 변경
http://songhl1.tistory.com/181

좋은 설명은 여기로
http://jwmx.tistory.com/833 
http://adnoctum.tistory.com/562  

한글/영문 변환 패치 (1.4.7 beta)
http://divestudy.tistory.com/15
(서버의 경우 nt service로 지정했을때 dll 파일을 덮어 쓸 수 없다. service off 하던가 unlocker를 이용해서 overwrite 해주면 됨)

'Tool' 카테고리의 다른 글

[Cygwin] 한글 깨짐  (0) 2012.04.06
Git Flow 좋은 자료  (0) 2012.03.18
번역기 추천  (0) 2012.03.13
Team Viewer  (0) 2012.03.08
오픈캡쳐 1.4와 호환  (0) 2012.02.13
Posted by '김용환'
,

ISO_639-1
http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPInternational/Articles/LanguageDesignations.html

 
Posted by '김용환'
,
Posted by '김용환'
,

번역기 추천

Tool 2012. 3. 13. 15:26

외국 웹 문서를 번역하기 위해서 매번 구글 번역기에 들어가지 않아도 되는 방법.

구글 크롬 브라우져의  Auto-Translate extension 설치하면 외국 웹 문서를 웹에서 바로 볼 수 있다. 


구글 크롬에서 옵션-확장프로그램Auto-Translate-옵션 에서 from japanese 수정하고, first,second 모두 japanese 변경하면 일본어->한국어로 쉽게 볼 수 있다.



 



control 키를 누르고 스크롤 하면 아래와 같이 한글로 번역되는 것을 볼 수 있다. 
 
 

'Tool' 카테고리의 다른 글

Git Flow 좋은 자료  (0) 2012.03.18
Synergy 를 다시 쓸 줄이야..  (0) 2012.03.16
Team Viewer  (0) 2012.03.08
오픈캡쳐 1.4와 호환  (0) 2012.02.13
자주 사용하는 notepad++ 팁  (0) 2012.02.08
Posted by '김용환'
,

iproute2 (tc)

c or linux 2012. 3. 12. 22:55

http://www.tldp.org/HOWTO/Traffic-Control-HOWTO/software.html#s-iproute2

iproute2 is a suite of command line utilities which manipulate kernel structures for IP networking configuration on a machine.

네트워크 bandwidth를 control할 수 있는 utility
Posted by '김용환'
,