Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
StarWars 
^ 
| *---+ 
|| 
|| +-----+ 
|| | | +-------+ 
|| | | | | +---------> 1000,000K 
0=| | | | | | msg/sec 
|| | | | ...
• 
• 
• 
• 
• 
• 
• 
•
XYZ 
+---------+ +--------------+ +-----------+ 
| NGINX | | LINUX KERNEL | | TARANTOOL| 
|---------| |--------------| |--...
3.MPI 
4.ØMQ, nanomsg, …
• ≈2 
•libt1h.1.0.so 
•
+----------+ 
| PRODUCER| 
|----------| 
| push() | 
+----------+ 
|| 
/ 
+----------+ 
| | 
| QUEUE| 
| | 
+----------+ 
...
+----------+ 
| PRODUCER| 
|----------| 
| push() | 
+----------+ 
|| 
/ 
+----------+ 
| | 
| QUEUE| 
| | 
+----------+ 
...
HOST_A 
HOST_B 
+----------+ SHARED MEMORY #1 
| PRODUCER| +-------+ 
| push() | ==>> | QUEUE| 
+----------+ +-------+ 
||...
+---------+ +--------+ 
| QUEUE | | BUFFER | 
|---------| | | 
| 0 | | begin##| 
| 0 | |########| +--------+ 
TAIL-> PTR--...
TAGGET_POINTER:= pointer | flags 
+---------+ 
| POINTER | 
|---------| 
| | ALIEN 
| bit_0 | SLIM 
| bit_1 | => PARCEL 
|...
+-------------+ +-------------+ +-------------+ 
| 1) SOLID| | 2) INDIRECT| | 3) WEAK| 
|-------------| |-------------| |-...
SERVERCOMMON / SHARED 
+--------+ +----------------+ 
| OBJECT | = CreateObject(TypeId,------>| BINDER| 
|--------| "libpr...
t1h::thread_assign_policy(HIPPEUS_WAITFREE); 
v 
| 
+---------+ | 
| TLS| | 
|---------| | 
| policy| <-----------+ 
+----...
void my_service::process(t1h::junction &io) 
{ 
t1h::batcher batch(io); 
while(msg= batch.pull()) { 
/* ... */ 
batch.push...
+-------------------------------------+ 
| ALLOT | 
|-------------------------------------| 
| battery | 
+---------+ +---...
+----------+ +----------+ 
| JUNCTION | | JUNCTION | 
|----------| |----------| 
| | | | 
| in <<<<<<<<<<<QUEUE<<<<<<<<<<<...
+----------1 +----------1 
| PRODUCER |2 | CONSUMER |2 
|----------||3 |----------||3 
| push()|||4 | pull()|||4 
+-------...
ØMQ,
•R&D подразделение в Сколково 
•решения для крупных операторов связи: BSS,Telcoprotocols, BigData, HA & Highload 
•≈ 21 го...
https://github.com/1Hippeus
1Hippeus -  zerocopy messaging по законам Спарты, Леонид Юрьев (ПЕТЕР-СЕРВИС)
1Hippeus -  zerocopy messaging по законам Спарты, Леонид Юрьев (ПЕТЕР-СЕРВИС)
1Hippeus -  zerocopy messaging по законам Спарты, Леонид Юрьев (ПЕТЕР-СЕРВИС)
1Hippeus -  zerocopy messaging по законам Спарты, Леонид Юрьев (ПЕТЕР-СЕРВИС)
1Hippeus -  zerocopy messaging по законам Спарты, Леонид Юрьев (ПЕТЕР-СЕРВИС)
1Hippeus -  zerocopy messaging по законам Спарты, Леонид Юрьев (ПЕТЕР-СЕРВИС)
Upcoming SlideShare
Loading in …5
×

1Hippeus - zerocopy messaging по законам Спарты, Леонид Юрьев (ПЕТЕР-СЕРВИС)

1,273 views

Published on

Доклад Леонида Юрьева на HighLoad++ 2014.

Published in: Internet
  • Be the first to comment

1Hippeus - zerocopy messaging по законам Спарты, Леонид Юрьев (ПЕТЕР-СЕРВИС)

  1. 1. StarWars ^ | *---+ || || +-----+ || | | +-------+ || | | | | +---------> 1000,000K 0=| | | | | | msg/sec || | | | | | || | | | +--------+ || | +------+ |+----+ | v BitMining
  2. 2. • • • • • • • •
  3. 3. XYZ +---------+ +--------------+ +-----------+ | NGINX | | LINUX KERNEL | | TARANTOOL| |---------| |--------------| |-----------| | | | | | | | | | | | | +---------+ +--------------+ +-----------+ +--------------------------------------------+ | | | RAM, a lofof... | | DMA_RING| +--------------------------------------------+ +--------------------------------------------+ | PCI Express | +--------------------------------------------+ +-----+ +------+ +-------+ +----------+ | NIC | | DISK | | GPU | | Xeon Phi | +-----+ +------+ +-------+ +----------+ xyz xyz xyz
  4. 4. 3.MPI 4.ØMQ, nanomsg, …
  5. 5. • ≈2 •libt1h.1.0.so •
  6. 6. +----------+ | PRODUCER| |----------| | push() | +----------+ || / +----------+ | | | QUEUE| | | +----------+ || / +----------+ | pull() | |----------| | CONSUMER| +----------+ ↔ ↔ ↔
  7. 7. +----------+ | PRODUCER| |----------| | push() | +----------+ || / +----------+ | | | QUEUE| | | +----------+ || / +----------+ | pull() | |----------| | CONSUMER| +----------+
  8. 8. HOST_A HOST_B +----------+ SHARED MEMORY #1 | PRODUCER| +-------+ | push() | ==>> | QUEUE| +----------+ +-------+ || / +-----------+ | pull() | | TRANSPORT| | push() | +-----------+ || / +-------+ +----------+ | QUEUE| ==>> | CONSUMER| +-------+ | pull() | SHARED MEMORY #2 +----------+
  9. 9. +---------+ +--------+ | QUEUE | | BUFFER | |---------| | | | 0 | | begin##| | 0 | |########| +--------+ TAIL-> PTR------->|####end | | BUFFER | | PTR| +--------+ | | | ... | | begin##| | PTR------->+--------+ |########| HEAD-> 0 | | BUFFER | |########| | 0 | | chunk1----->|####end | | 0 | | chunk2| +--------+ | 0 | | ... | +---------+ | chunkN----->+--------+ | | | BUFFER | +--------+ | | | begin##| |####end | +--------+
  10. 10. TAGGET_POINTER:= pointer | flags +---------+ | POINTER | |---------| | | ALIEN | bit_0 | SLIM | bit_1 | => PARCEL | bit_2 | INCORPOREAL | | ... | bit_3 | | ... | +--------+ | | ------------->| BUFFER | | | / |--------| | | / | | +---------+ | data | | | +--------+
  11. 11. +-------------+ +-------------+ +-------------+ | 1) SOLID| | 2) INDIRECT| | 3) WEAK| |-------------| |-------------| |-------------| | ref_counter| | ref_counter| | ref_counter| | tag | | tag | | tag | | _data >---------+ | _data>---------+ | _data>-----|--> ?.. | | | +-------------+ | | VMT| | -----------| | | +----------+--+ | |<--+ +-----------+ | | | | | | | | | space | | sk_buff|<--+ v | | | | class my_buffer | | +-----------+ : public T1H::buffer { | | | | | | virtual~my_buffer(); | | }; | | +-------------+
  12. 12. SERVERCOMMON / SHARED +--------+ +----------------+ | OBJECT | = CreateObject(TypeId,------>| BINDER| |--------| "libprovider.so"); |----------------| | Body |<----------------------------------------| | | TypeId| | TypeId| | Handle >----------------+ | Handle | +--------+ | | libprovider.so| | | Body ---------------+ || | | | | | v CLIENT| | +----------------------+ +--------+ v | | OBJECT's SHARED BODY | | OBJECT | = TakeObject(Handle); ----------------->| |----------------------| |--------| | | oxoo.... .... .... | | TypeId|<------------------------------o---------| | xxox.... .... .... | | Body | | +--| oooo.... .... .... | | Handle | +----------------+ | | | | Code |<---| libprovider.so |<--load--+ | data .... .... .... | +--------+ +----------------+ +----------------------+
  13. 13. t1h::thread_assign_policy(HIPPEUS_WAITFREE); v | +---------+ | | TLS| | |---------| | | policy| <-----------+ +----index| | +---------+ | | | +--------------------------- | | QUEUE | |------------------------- | | | | +------------+ +---->| ACTOR SLOT| | |------------| | | futex| | | tid| | | ... | | +------------+ | |
  14. 14. void my_service::process(t1h::junction &io) { t1h::batcher batch(io); while(msg= batch.pull()) { /* ... */ batch.push(msg); ----------------+ } | /* batcher's destructorhere */ | } | | | commit/flush* | | +---------------+ | | | ON STACK FIFO |<---+ | +---------------+ v +-------+ | QUEUE | +-------+
  15. 15. +-------------------------------------+ | ALLOT | |-------------------------------------| | battery | +---------+ +---------+ +---------+ | DEPOT_1| | DEPOT_2 | | DEPOT16 | |---------| |---------| ... |---------| | 256 | | 512 | | 16M | +---------+ +---------+ +---------+ +----------+ +------------+ +----+ +----+ | BASKET_1| | ACTOR SLOT |+ |TILE| |TILE| |----------|+ |------------||+ |----|...|----| | usual || | |||+ | | | | +----------+|+ | CACHE FIFO |||| +----+ +----+ | reserve || | ........ |||| +----------+|+ | ..BBBBBB |||| +----+ +----+ |dedicated || | BBBBB... |||| |TILE| |TILE| +----------+| | |||| |----|...|----| | offline | +------------+||| |BBBB| |BBBB| +----------+ +------------+|| +----+ +----+ +------------+| +------------+
  16. 16. +----------+ +----------+ | JUNCTION | | JUNCTION | |----------| |----------| | | | | | in <<<<<<<<<<<QUEUE<<<<<<<<<<< out | | | | | | out >>>>>>>>>>>QUEUE>>>>>>>>>>>in| | | | | | allot ------------+ +----------allot | | | | | | | | options| | | | options| | | v v| | +----------+ +-------------+ +----------+ | ALLOCATOR | |-------------| | BUF BUFBUF| | BUF BUFBUF| | | | BUF BUFBUF| | BUF BUFBUF| +-------------+ • • • •
  17. 17. +----------1 +----------1 | PRODUCER |2 | CONSUMER |2 |----------||3 |----------||3 | push()|||4 | pull()|||4 +----------+||| +----------+||| +----------+|| +----------+|| +----------+| +----------+| +----------+ +----------+ v ^ | | | | | +-------+ | | | QUEUE| | | |-------| | +-------> | | >------+ | | +-------+
  18. 18. ØMQ,
  19. 19. •R&D подразделение в Сколково •решения для крупных операторов связи: BSS,Telcoprotocols, BigData, HA & Highload •≈ 21 годполного цикла: разработка, внедрение и сопровождение •более 100 миллионов абонентовобслуживается при участии наших систем http://www.billing.ru
  20. 20. https://github.com/1Hippeus

×