Seastar
High performance C++ framework for concurrent servers
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
seastar::reactor Class Reference

Classes

struct  io_stats
 
struct  sched_stats
 Scheduling statistics. More...
 

Public Types

using poller = internal::poller
 
using idle_cpu_handler_result = seastar::idle_cpu_handler_result
 
using work_waiting_on_reactor = seastar::work_waiting_on_reactor
 
using idle_cpu_handler = seastar::idle_cpu_handler
 

Public Member Functions

alien::instancealien ()
 
void handle_signal (int signo, noncopyable_function< void()> &&handler)
 Register a user-defined signal handler.
 
 reactor (std::shared_ptr< smp > smp, alien::instance &alien, unsigned id, reactor_backend_selector rbs, reactor_config cfg)
 
 reactor (const reactor &)=delete
 
void operator= (const reactor &)=delete
 
sched_clock::duration uptime ()
 
io_queueget_io_queue (dev_t devid=0)
 
io_priority_class register_one_priority_class (sstring name, uint32_t shares)
 
future update_shares_for_class (io_priority_class pc, uint32_t shares)
 
void configure (boost::program_options::variables_map config)
 
server_socket listen (socket_address sa, listen_options opts={})
 
future< connected_socketconnect (socket_address sa)
 
future< connected_socketconnect (socket_address, socket_address, transport proto=transport::TCP)
 
pollable_fd posix_listen (socket_address sa, listen_options opts={})
 
bool posix_reuseport_available () const
 
pollable_fd make_pollable_fd (socket_address sa, int proto)
 
future posix_connect (pollable_fd pfd, socket_address sa, socket_address local)
 
future write_all (pollable_fd_state &fd, const void *buffer, size_t size)
 
future< fileopen_file_dma (std::string_view name, open_flags flags, file_open_options options={}) noexcept
 
future< fileopen_directory (std::string_view name) noexcept
 
future make_directory (std::string_view name, file_permissions permissions=file_permissions::default_dir_permissions) noexcept
 
future touch_directory (std::string_view name, file_permissions permissions=file_permissions::default_dir_permissions) noexcept
 
future< std::optional< directory_entry_type > > file_type (std::string_view name, follow_symlink=follow_symlink::yes) noexcept
 
future< stat_data > file_stat (std::string_view pathname, follow_symlink) noexcept
 
future< uint64_t > file_size (std::string_view pathname) noexcept
 
future< bool > file_accessible (std::string_view pathname, access_flags flags) noexcept
 
future< bool > file_exists (std::string_view pathname) noexcept
 
future< fs_typefile_system_at (std::string_view pathname) noexcept
 
future< struct statvfs > statvfs (std::string_view pathname) noexcept
 
future remove_file (std::string_view pathname) noexcept
 
future rename_file (std::string_view old_pathname, std::string_view new_pathname) noexcept
 
future link_file (std::string_view oldpath, std::string_view newpath) noexcept
 
future chmod (std::string_view name, file_permissions permissions) noexcept
 
future< int > inotify_add_watch (int fd, std::string_view path, uint32_t flags)
 
future< size_t > submit_io_read (io_queue *ioq, const io_priority_class &priority_class, size_t len, internal::io_request req, io_intent *intent) noexcept
 
future< size_t > submit_io_write (io_queue *ioq, const io_priority_class &priority_class, size_t len, internal::io_request req, io_intent *intent) noexcept
 
int run () noexcept
 
void exit (int ret)
 
future when_started ()
 
template<typename Rep , typename Period >
future wait_for_stop (std::chrono::duration< Rep, Period > timeout)
 
void at_exit (noncopyable_function< future<>()> func)
 
template<typename Func >
void at_destroy (Func &&func)
 
taskcurrent_task () const
 
void add_task (task *t) noexcept
 
void add_urgent_task (task *t) noexcept
 
void set_idle_cpu_handler (idle_cpu_handler &&handler)
 
void force_poll ()
 
void add_high_priority_task (task *) noexcept
 
network_stacknet ()
 
shard_id cpu_id () const
 
void sleep ()
 
steady_clock_type::duration total_idle_time ()
 
steady_clock_type::duration total_busy_time ()
 
std::chrono::nanoseconds total_steal_time ()
 
const io_statsget_io_stats () const
 
sched_stats get_sched_stats () const
 
uint64_t abandoned_failed_futures () const
 
future readable (pollable_fd_state &fd)
 
future writeable (pollable_fd_state &fd)
 
future readable_or_writeable (pollable_fd_state &fd)
 
void abort_reader (pollable_fd_state &fd)
 
void abort_writer (pollable_fd_state &fd)
 
void enable_timer (steady_clock_type::time_point when) noexcept
 
void set_strict_dma (bool value)
 
void set_bypass_fsync (bool value)
 
void update_blocked_reactor_notify_ms (std::chrono::milliseconds ms)
 
std::chrono::milliseconds get_blocked_reactor_notify_ms () const
 
void set_stall_detector_report_function (std::function< void()> report)
 
std::function< void()> get_stall_detector_report_function () const
 

Static Public Member Functions

static boost::program_options::options_description get_options_description (reactor_config cfg)
 
static sched_clock::time_point now () noexcept
 
static future rename_priority_class (io_priority_class pc, sstring new_name) noexcept
 

Class Documentation

◆ seastar::reactor::io_stats

struct seastar::reactor::io_stats
Class Members
uint64_t aio_errors
uint64_t aio_read_bytes
uint64_t aio_reads
uint64_t aio_write_bytes
uint64_t aio_writes
uint64_t fstream_read_ahead_discarded_bytes
uint64_t fstream_read_aheads_discarded
uint64_t fstream_read_bytes
uint64_t fstream_read_bytes_blocked
uint64_t fstream_reads
uint64_t fstream_reads_blocked

◆ seastar::reactor::sched_stats

struct seastar::reactor::sched_stats
Class Members
uint64_t tasks_processed

Total number of tasks processed by this shard's reactor until this point. Note that tasks can be tiny, running for a few nanoseconds, or can take an entire task quota.

Member Function Documentation

◆ alien()

alien::instance& seastar::reactor::alien ( )
inline

Obtains an alien::instance object that can be used to send messages to Seastar shards from non-Seastar threads.

◆ get_sched_stats()

sched_stats seastar::reactor::get_sched_stats ( ) const

Returns statistics related to scheduling. The statistics are local to this shard.

See sched_stats for a description of individual statistics.

Returns
An object containing a snapshot of the statistics at this point in time.

◆ set_idle_cpu_handler()

void seastar::reactor::set_idle_cpu_handler ( idle_cpu_handler &&  handler)
inline

Set a handler that will be called when there is no task to execute on cpu. Handler should do a low priority work.

Handler's return value determines whether handler did any actual work. If no work was done then reactor will go into sleep.

Handler's argument is a function that returns true if a task which should be executed on cpu appears or false otherwise. This function should be used by a handler to return early if a task appears.

◆ set_strict_dma()

void seastar::reactor::set_strict_dma ( bool  value)

Sets the "Strict DMA" flag.

When true (default), file I/O operations must use DMA. This is the most performant option, but does not work on some file systems such as tmpfs or aufs (used in some Docker setups).

When false, file I/O operations can fall back to buffered I/O if DMA is not available. This can result in dramatic reducation in performance and an increase in memory consumption.


The documentation for this class was generated from the following file: