High performance C++ framework for concurrent servers
Classes | Functions

Detailed Description

Support for exploiting multiple cores on a server.

Seastar supports multicore servers by using sharding. Each logical core (lcore) runs a separate event loop, with its own memory allocator, TCP/IP stack, and other services. Shards communicate by explicit message passing, rather than using locks and condition variables as with traditional threaded programming.

Smart pointer wrapper which makes it safe to move across CPUs.

foreign_ptr<> is a smart pointer wrapper which, unlike shared_ptr and lw_shared_ptr, is safe to move to a different core.

As seastar avoids locking, any but the most trivial objects must be destroyed on the same core they were created on, so that, for example, their destructors can unlink references to the object from various containers. In addition, for performance reasons, the shared pointer types do not use atomic operations to manage their reference counts. As a result they cannot be used on multiple cores in parallel.

foreign_ptr<> provides a solution to that problem. foreign_ptr<> wraps smart pointers – seastar::shared_ptr<>, or similar, and remembers on what core this happened. When the foreign_ptr<> object is destroyed, it sends a message to the original core so that the wrapped object can be safely destroyed.

foreign_ptr<> is a move-only object; it cannot be copied.


class  seastar::sharded< Service >
class  seastar::async_sharded_service< T >
class  seastar::peering_sharded_service< Service >
 Provide a sharded service with access to its peers. More...
class  seastar::no_sharded_instance_exception
 Exception thrown when a sharded object does not exist. More...
class  seastar::sharded_parameter< Func, Params >
 Helper to pass a parameter to a sharded<> object that depends on the shard. It is evaluated on the shard, just before being passed to the local instance. It is useful when passing parameters to sharded::start(). More...
class  seastar::foreign_ptr< PtrType >


template<typename T >
foreign_ptr< T > make_foreign (T ptr)

Function Documentation

◆ make_foreign()

template<typename T >
foreign_ptr< T > make_foreign ( ptr)

Wraps a raw or smart pointer object in a foreign_ptr<>.