node.js를 사용하다가 스케일링에서 이슈가 있어서 netty로 바꿨던 Plurk 개발자의 이야기를 한글로 번역했다. 틀린 내용이 많음..



Plurk (http://www.plurk.com/) 싸이트의 개발자가 node.js를 comet 솔루션으로 적용한 후기를 적은 내용입니다. Plurk는 twitter 같은 서비스인거 같음. 구글 트렌드에 나올 정도면 영향력은 조금 있는 것 같음(http://www.google.com/trends?q=Plurk&ctab=0&geo=all&date=all&sort=1)


출처:
http://amix.dk/blog/post/19577#Is-node-js-best-for-Comet
(번역에 대해서 메일로 허락 받음)

내용:
Plurk 웹 싸이트에서 comet을 이용하여 사용자에게 실시간 업데이트 (트위팅같은거 같음)을 전달해주는 것을 했어. 우리는 scaling 때문에 다양한 솔루션을 시도했지.

1. 첫번째, 우리는 polling을 python으로 구현했었어. 그런데, scaling이 잘 되지 않아서, C, memcached, nginx/libenvent를 이용해서 다시 만들었어.
2. 하지만, C 서버로는 다시 한계에 봉착했지. 두번째로 Java와 Netty를 이용해서 10만 동접을 처리하도록 했다.
3. 그 다음에 node.js를 이용해서 서버단의 cpu와 메모리를 적게 소비하도록 했다.

node.js를 이용했을 때 지난 8개월간은 아주 작동이 잘 되었고, 수백만건의 comet 이벤트(comet notification)를 잘 처리했지. 그러나 이벤트를 처리하면서 이슈가 발생되면서, node.js 최적화 작업을 진행했어.

1. node.js 버젼을 0.1.33 에서 0.2.2로 업그레이드 했다. 0.2.2는 성능이 안좋게 나왔고, 메모리릭이 있었어
2. 데이터 구조를 최적화하고,
3. Redis 사용을 시도했지.
4. Channel에 대해서 Proxy 사용도 해봤어.

최적화 작업은 모두 잘 안되었고, 새로운 하드웨어 장비가 와서 결국 해결 되었지.
(정확한 문제의 원인은 블로그에 나와있지 않음. 어떤 이슈인지 잘 모르겠음. 문맥상 성능 이슈인것 같음)

예전 Netty 솔루션을 다시 적용해서 최적화하고 나서 사용했어. 메모리를 좀 많이 먹었지만, 성능은 좀 더 나아졌어. 하나의 Netty 서버가 약 10,000 클라이언트가 보내는 약 6000개의 comet 이벤트를 처리했어.
반면, node.js 서버는 초당 500개를 처리했지.

node.js가 최고의 comet 솔루션일까?

난 돌아가는 솔루션을 최대한 빨리(ASAP) 사용하고 싶었어. web-scale 을 원한다면, java+nio나 C/C++ 쓰면 될꺼야. node.js는 지난 8개월간 수백만건의 comet 이벤트를 매일 처리해줬지. 난 2일만에 BO를 node.js를 이용해서 구현했어.. 굉장히 심플했거든

그런데. node.js가 사용하고 있는 Javascript 엔진인 V8은 심각한 문제가 있는거 같아.
V8은 쓰레드나 프로세스를 지원하고 있지 않아. 즉, main 프로세스가 처리하고 GC해주거든.

이런 한계 때문에 서버에서 쓰이기 보다는 웹 브라우져에서만 사용되는게 아닌가 싶어.
우리가 node.js를 사용할때, 채널에 대해서 read/write하는게 하나의 프로세스에서 처리되는 부분이 문제야.
채널에 write 하려고 하는데, read하고 gc하는 것때문에 느려진다는 의미를 가지거든.

자바 솔루션은 이런 문제를 쉽게 해결했어. 쓰레드를 돌려 채널 write를 빨리 할 수 있었거든. node.js는 이런게 안되.

끝으로 나는 여전히 node.js가 맘에 들어. 우리가 처음 서비스했을 때, 나름 성능을 제공했어.
우리의 고민들과 경험들이 공유되면 좋겠네.


--
댓글중.
- 이 문제는 커뮤니티에 물어봐. 성능이 너무 안좋게 나온것 같은데.
- node.js가 점점 커가는 중이니까, process/worker 쪽으로는 아직 개발이 덜 된 것 같아. 잠재력이 있으니 기다려보자
- Fugue(https://github.com/pgte/fugue, unix socket 을 이용해서 master/slave를 연동하는 worker 프로세스 모델)을 node.js랑 붙여서 쓰고 있어~
- 우리도 너희랑 비슷한 문제가 있었어
- 그 문제 관련해서 패치가 되었어
- V8 힙이 약간 불안전해.
- node.js에 web worker 방식이 있으니 살펴봐 (https://github.com/pgriess/node-webworker)
- scaling과 관련된 좋은 사례 공유해줘서 고마워
- multiple processing과 관련 이슈인거 같네. 2-3개 물리 장비에 DNS에 붙여서 failover시 다른 장비가 처리하게 해봐
- slow connection에 소켓을 사용하면서 난 이슈인거 있아. 한 장비에 nginx와 HAProxy를 써서 여러개의 인스턴스를 가진 node.js를 로드 밸런스하게 하면 문제가 나타나지 않게 하면 될 것 같아.
  아님 장비를 나눠도 되구


Posted by '김용환'
,

Migratory(http://migratory.ro/)라는 회사에서 scalable 한 web socket/ comet 서버를 내어 놓았다.
한 서버당 동접 백만명이 사용할 수 있다고 한다.

성능 테스트 자료는 다음과 같다.
http://migratory.ro/data/Migratory-Push-Server-Performance-Benchmarks.pdf

음.. 잘만든거 같아..
Posted by '김용환'
,

2011.7.5

http://www.readwriteweb.com/archives/google_making_open_source_push_to_be_leader_in_rea.php

구글은 구글 크로니움에 webRTC(http://www.webrtc.org/)을 구글 크롬 브라우져에서 넣는 것을 진행하고 있다고 발표했다. webRTC는 웹 브라우져를 이용해서 Real time 통신 툴로서, HTML5와 javascript api를 이용해서 상대방과 영상/전화 통화하는 오픈 소스 프로젝트이다.

기사에서는 간단히 나와있지만, real time communication에 대한 스펙을 보면,.. 오디오/비디오/협업/게임 등 폭넓은 상호 통신하는 브라우져 통신 모델에 대해서 정의를 내리는 것으로 되어 있다. 그래서 브라우져에 기본 브라우져에 탑재하려는 시도 있음을 알 필요가 있다. 특히. 처음에는 real time 으로 audio/video 통신이지만, 추후에는 데이터가 전달되는 경우도 보고 있음을 주목할 필요가 있다.

출처 : http://tools.ietf.org/wg/rtcweb/charters

  There are a number of proprietary implementations that provide direct
  interactive rich communication using audio, video, collaboration,
  games, etc. between two peers' web-browsers. These are not
  interoperable, as they require non-standard extensions or plugins to
  work.  There is a desire to standardize the basis for such
  communication so that interoperable communication can be established
  between any compatible browsers. The goal is to enable innovation on
  top of a set of basic components.  One core component is to enable
  real-time media like audio and video, a second is to enable data
  transfer directly between clients.



위의 기사에 따르면, 구글은 웹 표준을 주도하여 혁신과 비즈니스 성공을 이끌어 낼 수 있을 것이라 생각하고 있다.

어느 디바이스든 상관없이 웹 브라우져가 되는 곳이라면 사용가능한 웹앱으로 만들어 낼 수 있다.

아래는 아키텍처로서, 개발자가 가질 영역과 브라우져 개발자가 만들 voice/video/transport 엔진을 보여주고 있다. 최대한 license가 문제가 되지 않는 코덱을 사용하였으며...
유독 특징적으로 볼만한 부분은 transport에 기본적인 streaming, multiplexing 외에 p2p 영역을 추가했다는 부분이다.

WebRTC_Diagram.jpg

실제 어떤 통신 프로토콜(Sequence)에 동작되는지 확인하려면,아래 정보를 보면 된다.
http://www.webrtc.org/reference




구글, 모질라, 오페라에서 지원하고 있어서 표준이 조만간 인정받을 것으로 보인다.

기사에서 언급된 주소는 블로그를 출처로 두고 있다. 원문에 따르면, 정말 크로니움에 넣으려고 한다는 점을 주목할 필요가 있다.

http://www.webrtc.org/blog

First Step Toward Chrome Integration

posted Jun 18, 2011 5:07 PM by Jan Linden   [ updated Jun 20, 2011 6:25 AM by Serge Lachapelle ]

As a first significant step toward integrating the WebRTC project into Chrome the WebRTC code is now about to land in Chromium as third party software at src/third_party/webrtc. This means that the crucial media processing capabilities necessary to implement real-time communication are available as a part of Chromium.

We are working hard to complete the remaining steps for a full integration in Chromium and Chrome including JavaScript APIs in WebKit and handling of the native audio and video capture and rendering. When we are done, any web developer shall be able to create RTC applications, like the Google Talk client in Gmail, without using any plugins but only WebRTC components that runs in the sandbox.

Update 6/20/2010: Fixed Font.



IETF RTCWEB 표준을 보면, WG에 대한 역할과 담당자, 어떤 마일스톤을 가지고 있는지 확인할 수 있다.


출처 : http://tools.ietf.org/wg/rtcweb/charters

Goals and Milestones:
  Aug 2011 - Architecture, Security, Privacy and Threat Model sent to W3C
  Aug 2011 - Use cases, Scenarios, and Requirements document (I-D) sent to W3C
  Sep 2011 - Architecture and Security, Privacy, and Threat Model document(s) to IESG as Informational
  Sep 2011 - Use cases, Scenarios, and Requirements for RTCWeb document sent to IESG as Informational
  Dec 2011 - RTCWeb protocol profiles and Media format specification(s) to IESG as PS
  Dec 2011 - Information elements and events APIs Input to W3C
  Apr 2012 - API to Protocol mapping document submitted to the IESG as Informational (if needed)




comment : 브라우져로 모든 것을 할 수 있게 하는 전략에 깜짝 놀래게 한다. 그동안 Native App을 이용하지 않고 간단하게 웹만을 이용해서 실시간 동영상과 p2p을 지원하다면, 지금의 현재 한국의 상태가 상당히 달라질 수 있을 것 같다..




Posted by '김용환'
,



LearnAbout HTML5 and the Future of the Web
 

발표 자료 : HTML 5 Slide Deck : html5가 지원되는 브라우져 이용할 것, 크롬.
http://slides.html5rocks.com



Learn About HTML5 Communications APIs


발표자료 PDF파일 : http://assets.en.oreilly.com/1/event/37/Harnessing%20the%20Power%20of%20HTML5%20Web%20Sockets%20to%20Create%20Scalable%20Real-time%20Applications%20Presentation.pdf



HTML5 vs Native App
http://www.html5rocks.com/en/mobile/nativedebate.html

2010 Future Mobile Web application 컨퍼런스 참가기
http://bitroid.wordpress.com/tag/%ED%91%9C%EC%A4%80%ED%99%94/

Posted by '김용환'
,
용두사미이긴 하지만, 조금은 괜찮은 정보??









Posted by '김용환'
,







PhoneGap, Appspresso, Titanium 등이 열심히 달리고 있음..
Posted by '김용환'
,

특별히 서비스에는 영향이 없지만, 재시작을 할 때마다 이런 로그를 발생할 수 있다.

2011. 4. 7 오후 4:21:08 org.apache.catalina.startup.HostConfig deployDescriptor

정보 : Deploying configuration descriptor manager.xml

2011. 4. 7 오후 4:21:08 org.apache.catalina.core.StandardContext resourcesStart

정보 : Error starting static Resources

java.lang.IllegalArgumentException: Document base /home1/irteam/apps/tomcat/webapps/manager does not exist or is not a readable directory

        at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:142)

        at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4319)

        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488)

        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)

        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)

        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)

        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)

        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)

        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)

        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)

        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)

        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)

        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)

        at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)

        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)

        at org.apache.catalina.core.StandardService.start(StandardService.java:525)

        at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)

        at org.apache.catalina.startup.Catalina.start(Catalina.java:595)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:597)

        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)

        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

원인은 webapps 디렉토리를 지우기 전에 한번이라도 재시작을 했을 때, 톰캣 서버 내부에서는 conf/Catalina 디렉토리 밑에 다음과 같은 디렉토리를 만들어 캐쉬합니다. 

conf/Catalina/localhost/manager.xml

conf/Catalina/localhost/host-manager.xml

conf/Catalina/dev-service.google.com/host-manager.xml

conf/Catalina/dev-service.google.com/manager.xml

 캐쉬된 파일은 따로 수정하지 않으면 계속 남아있게 되면서 계속 Exception을 발생할 수 있다. 아래 파일들을 지우면, 다시는 exception이 발생되지 않는다.

Tomcat에서 webapps 디렉토리보다 conf/Catalina를 먼저 읽기 때문에 이런 일이 발생된다. 따라서, Tomcat 서버를 설치 할 때부터 톰캣 설치디렉토리의 webapps 디렉토리를 삭제하면, 이런 일은 발생되지 않는다.

Posted by '김용환'
,

Ognl은 Lucy 1.6까지의 Webwork MVC의 core library 입니다.

Webwork 개발자가 webwork를 떠나 struts2로 이동하면서 webwork, ognl, sitemesh가 좀 버려진(?) 상태로 있었습니다.

 

올해 초, ognl 마지막 남은 commiter(Lukasz)가 Apache Common 개발자 리스트에 도움을 요청하였습니다. 원래 개발자들도 ASF로 소스 이전하는 것에 대해서 찬성했지요. Common쪽에서 이를 지원하기 위해서 투표를 했고,  통과하였습니다.

 

그래서 아래와 같은 Proposal 싸이트가 만들어졌고, 모두 긍정적이기 때문에 조만간에 Incubator로 들어갈 예정입니다..

http://wiki.apache.org/incubator/OGNLProposal

  

Ognl을 사용하고 있는 중요 라이브러들은 Struts, Tapestry, MyBatis, Spring Webflow 였네요.. (생각보다 중요한 라이브러리였네요.)

 

Posted by '김용환'
,

Facebook 기술

Web service 2011. 3. 16. 15:41

Facebook Engineering님의 동영상

http://www.facebook.com/video/video.php?v=707216889765


Posted by '김용환'
,

1) 윈도우에서 ftp command 사용하기.

쉘> ftp
ftp> open <서버명> <포트번호>

* 주의 : 바로 ftp 서버명 포트번호 주면 실행되지 않는다.

2) 리눅스에서 ftp command 사용하기

쉘> ftp <서버명> <포트번호>


참고로, 웹브라우져나 탐색기를 이용해서 ftp 사용하기

ftp://서버명:포트번호

Posted by '김용환'
,