Go Back   FlashFXP Forums > > > >

Knowledge Base Known solutions to common problems.

Thread Tools Rate Thread Display Modes
Old 04-03-2004, 11:45 AM   #1
FlashFXP Registered User
ioFTPD Administrator
darkone's Avatar
Join Date: Dec 2001
Posts: 2,230
Default IO, Worker, and Encryption Threads Explained

It's really impossible to explain meaning of them, if one does not know basics of thread pooling. Optimal settings vary per system configuration (logical cpus) and use of daemon (large anonymous server, private server, private encrypted server)

Here's a brief explanation, that explains what threads do (doesn't explain their relationship with other threads, such as timer or socket scheduler)

IO threads are used for io activity. Everything besides io related actions, are handled in other threads. This ensures, that daemon throughput performance is not limited by actions handled within io threads. This level have the highest priority level of all pooled threads.

Encryption threads are used exclusively for encryption, decryption and integrity checking. Data is dispatched from io thread to encryption thread, in a continous stream. Which means, there's lots of interactions betweens these two types of threads. (Most costly action being ssl encrypted upload, which first goes from io thread to encryption thread, from encryption thread to io thread, from io thread to encryption thread (once buffer is full), and from encryption thread back to io thread (once crc has been calculated). (in worst case 4 thread context switches per 'internal buffer' size of data, 0 in best case scenario)

Worker threads handle almost everything else. Timer jobs (timer is managed in another thread), client input parsing (yes, io threads do not parse input themselve.. this might be moved to encryption threads), client command responses, scripts, .... This pool is the only pool that has dynamic size, and dynamic priorities (pool might temporarily grow beyond the specified limit, to ensure that jobs are scheduled in-time) Size of this pool is something you should increment, if your site relies heavily on scripts.

IOs threading model, is much more complicated what most applications nowdays use. For me it has been more of experimenting different models, and finding the most suitable for daemon use. (which is, what current model represents.. even with thousands of ssl connections - server should be quite responsive.. thanks to encryption queuing, and priority reserved for io threads)

Optimal amount for io threads, is 2x number of logical cpus.
Optimal amount for worker threads on site that runs lots of scripts, is ~half of max users online.
Optimal amount for encryption threads, is number of logical cpus.

To understand what is a difference between single threaded (servu), thread per client model (apache, glftpd, raidenftpd), pool of threads (iis) and ios model (??), one needs to study threading a lot.
darkone is offline  

encryption, pool, thread, threads, upload

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 12:13 PM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)