mOS is a specialized networking stack for developing stateful middleboxes. It allows the developers to focus on the core middlebox logic instead of re-implementing complex TCP flow management for each custom middlebox. mOS encourages modular programming of middleboxes by allowing to express custom middlebox operations with a set of event and event handlers. mOS event is defined as a notable condition that triggers middlebox-specific action, and is the key abstraction of mOS application.
In this thesis, we focus on the performance scalability of the mOS event system where an application needs to handle several hundreds of thousands of concurrent flows with a dynamically changing event set. To achieve low memory usage and fast event registration at the same time, we design the mOS event system to easily share event metadata across multiple flows, and to allocate metadata IDs for efficient hash table lookup. We observe that the mOS’s event system outperforms the original design, and increases the overall event performance of mOS by up to almost twice, even when the system experiences frequent dynamic event registration with 192 K concurrent flows. The mOS event system delivers not only flexibility but also high performance, capable of handling a large number of concurrent flows.
현대의 인터넷에서 미들박스는 빠질 수 없는 구성요소가 되었고 그 수 역시 라우터의 수에 비견될 만큼 많아진지 오래임에도 불구하고 미들박스 개발은 어려운 작업으로 남아있다. 이는 논리적으로 간단한 미들박스를 작성하려고 하여도 복잡하고 구현하기 어려운 TCP 프로토콜 처리가 필요하기 때문이다. 그 뿐 아니라 현재까지 개발된 오픈소스 미들박스들은 소스코드가 충분히 모듈화 되어있지 못하여 코드의 재사용이 어렵다. 결과적으로 미들박스 개발자들은 매 미들박스 개발마다 이미 개발된 다른 미들박스의 구성요소를 재사용하는 대신 거의 같은 기능을 수행하는 코드를 새로이 작성하고 있다.
미들박스를 위한 네트워킹 스택인 mOS는 이를 해결하기 위하여 개발되었다. mOS는 개발이 어렵고 안정화에 긴 시간이 걸리는 TCP 프로세싱 기능을 제공할 뿐 아니라 고유한 이벤트 시스템을 통하여 미들박스 개발자가 구현하고자 하는 미들박스 기능을 직접 정의한 이벤트와 그 이벤트에 대응하기 위한 코드로 간단히 나누어 구현할수 있도록 유도한다. 결과적으로 mOS를 사용하는 개발자는 복잡한 네트워크 처리 대신 오직 개발하고자 하는 기능에만 집중할 수 있고 또한 가능하다면 다른 미들박스에서 정의한 이벤트를 가져다 사용할 수 있다.
이 논문은 mOS의 이벤트 시스템을 특히 확장성에 초점을 맞추어 기술한다. mOS 이벤트 시스템은 각각의 TCP 연결마다 이벤트를 동적으로 등록할수 있는 유연성을 제공하면서도 수십만에서 수백만개에 이르는 다수의 TCP 연결들을 동시에 처리할 때 성능 저하가 일어나지 않도록 설계되었다. 각각의 TCP 연결마다 서로 다를 수 있는 이벤트 등록정보에 특수한 고유번호를 부여하여 여러 TCP 연결이 하나의 이벤트 등록정보를 공유할 수 있게 하는 것이 설계의 핵심이다. mOS 이벤트 시스템은 이를 통하여 동시에 19만개의 연결을 동시에 처리하는 상황에서 전반적인 mOS의 성능을 두 배로 높였다.