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


struct  io_stats

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

void handle_signal (int signo, noncopyable_function< void()> &&handler)
 Register a user-defined signal handler.
 reactor (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)
 Updates the current amount of shares for a given priority class. More...
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_datafile_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)
void submit_io (io_completion *desc, internal::io_request req) noexcept
future< size_t > submit_io_read (io_queue *ioq, const io_priority_class &priority_class, size_t len, internal::io_request req) noexcept
future< size_t > submit_io_write (io_queue *ioq, const io_priority_class &priority_class, size_t len, internal::io_request req) noexcept
int run ()
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
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)
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 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

Member Function Documentation

◆ set_idle_cpu_handler()

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

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.

◆ update_shares_for_class()

future seastar::reactor::update_shares_for_class ( io_priority_class  pc,
uint32_t  shares 

Updates the current amount of shares for a given priority class.

This can involve a cross-shard call if the I/O Queue that is responsible for this class lives in a foreign shard.

pcthe priority class handle
sharesthe new shares value
a future that is ready when the share update is applied

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