handling differences in execution environment
play

Handling Differences in Execution Environment Nachshon Cohen , EPFL - PowerPoint PPT Presentation

Handling Differences in Execution Environment Nachshon Cohen , EPFL Durable & Transient Representation Transient Person: doesnt survive restarts class Person{ char *name; Person *spouse; lock plock; virtual research(); } Durable


  1. Handling Differences in Execution Environment Nachshon Cohen , EPFL

  2. Durable & Transient Representation Transient Person: doesn’t survive restarts class Person{ char *name; Person *spouse; lock plock; virtual research(); }

  3. Durable & Transient Representation Transient Person: Durable Person: doesn’t survive restarts survives restarts class Person{ DurablePerson scheme char *name; sqlString<30> name; Person *spouse; id spouse; lock plock; virtual research(); int CoffeeLevel; }

  4. Durable & Transient Representation Keep two representations Significant effort Can we do better? Sure, use NVM!

  5. Durable & Transient Representation Durable NVM person class Person{ PTR<char> name; PTR<Person> spouse; executionLock plock; / / virtual research(); int CoffeeLevel; }

  6. Durable & Transient Representation class Person{ Weird pointers PTR<char> name; PTR<Person> spouse; Different lock executionLock plock; / / virtual research(); No virtual methods or int CoffeeLevel; function pointers }

  7. Durable & Transient Representation NvmReconstruction Person: survives restarts class Person : public nvm_obj{ char *name; Person *spouse; Retains original lock plock; structure virtual research(); REGISTER_CLASS(Person); REGISTER_NVMPTR(name, spouse); API discussed REGISTER_TRANSIENT(plock); later }

  8. Outline Why Durable NVM Person is so complex? How NvmReconstruction solves these problems? Demonstration and measurements

  9. Why Durable NVM Person is so Complex? 1. Why cannot use virtual methods? 2. Why cannot use standard pointers? 3. Why need special lock? 4. Why cannot use pointers to DRAM?

  10. Virtual Methods? Implemented by Virtual Table Pointer (VTP) But: VTPs may move between executions B A virtual research()

  11. No Virtual Methods! Virtual Table Pointers may be moved A call to a virtual method executes arbitrary code. Similar problem for function pointers in C. B A Erase filesystem virtual research()

  12. No Virtual Methods! NO SUPPORT for virtual methods NO SUPPORT for function pointers If program uses virtual methods Significant programmer effort

  13. NVM Pointers? base = mmap(0 x 1000, …, nvm_fd); But, kernel may mmap to a different address B A virtual research() 0 x 1000 0 x 1200

  14. No NVM Pointers !? base = mmap(0 x 1000, …, nvm_fd); But, kernel may mmap to a different address E.g., 0 x 2000 Invalidate pointers B A v 0 x 1200 0 x 2000

  15. Weird NVM Pointers Store offset instead of virtual address Slower Different signature, dereference via a method MUST NOT have a pointer signature Programmer effort

  16. Intermixing Volatile and Non- Volatile Fields Forbid NVM to DRAM pointers [ASPLOS’11] However: shown to be quite common and useful [HotStorage’17] Thus: programmer effort Execution specific lock [ASPLOS’11] Different signature, programmer effort

  17. Durable Person is Complex 1. Cannot use virtual methods! 2. Cannot use standard pointers! 3. Need special lock! 4. Cannot use DRAM pointers!

  18. NvmReconstruction Solve all problems above Simple interface No compiler support needed Zero overhead after recovery

  19. Main Idea During re-execution, need to reconstruct objects class Person{ NVM Correct char *name; Person *spouse; VTP 0xF00D 0xCAFE lock plock; virtual research(); spouse 0x1200 0x2200 } etc. X f(X)

  20. Main Idea For each live object: Fix VTP Rebase pointers Zero transient fields Requires: type of the object (or VTP) field information

  21. Get Object Type VTP uniquely identify the object type However: VTP is correct for previous execution. Solution: Map VTP to class name. Store on NVM. Get mapping: from previous VTP to class name. Thus: map previous VTP to current VTP. Fix Type.

  22. Field Information Use virtual methods to query the object layout common interface reconstructObj(void *obj){ nvm_obj *nobj = (nvm_obj*)obj; pointers = nobj->getNvmPtr(); foreach p in pointers virtual p -= mmap_offset; method API: REGISTER_NVMPTR(name, spouse);

  23. Lazy Algorithm Reconstructing entire heap is time consuming Large restart time Lazy reconstruction: reconstruct a page on first access Using memory protection mechanism Immediate restart

  24. Demonstration and Measurements Restart time? How easy it is to write recovery?

  25. Restart time 1GB heap, 50% populated 347µs per MB for first access Tradeoff restart-time and efficiency

  26. Echo Key-Value Store Fast Key-Value Store Over 15,000 lines of code Uses function pointers NVM pointers pthread_mutex pointers (in DRAM)

  27. Echo Key-Value Store + NvmReconstruction Less than 1.5 days to write recovery code Many crashes in original code Less than 1 hour to apply actual API Easy to use

  28. Summary: NvmReconstruction NVM allows to easily persist data But does not preserve the semantics of the data NvmReconstruction: reconstruct durable objects Each to use: persist a class in a few minutes! No weird restrictions

Recommend


More recommend