When I am running Alkaline, ps or top show me more than one process, why and what are those processes doing? Do 4 processes of 10Mb mean that a total of 40Mb of memory is consumed?

If you run Alkaline without the -daemon option, Alkaline will create a managing process that will launch the indexer. Alkaline will fork itself before any data is loaded and will create a new process. The managing process allows to start and stop Alkaline, it is generally sleeping and consumes just a few kilobytes of memory. If you run the daemon with -daemon , the controlling process will exit leaving you generally with one single process.

For indexing and searching Alkaline spawns threads. A thread is not a full-featured process. It shares data with the main process and takes little memory in itself. It might show the same memory usage, but in this case memory is consumed once only (it is shared between all threads).

When indexing in background, a pool of threads with a maximum size defined by the -mi command-line option is readily available for a new indexing job. A job typically performs the fetch and indexing of a single url. If you run Alkaline with --noreindex , the indexing process is disabled completely and no indexing thread is created unless you request Alkaline to index a single url from the online administration.

Using Reindex=N in all asearch.cnf files is not equivalent to --noreindex in terms of thread management. Alkaline cannot know for sure whether a different configuration has Reindex=N and potentially can reload an asearch.cnf file on the fly. This may be responsible for at least one additional thread spawned from time to time.

When users perform search operations, a pool of threads is readily available for fast response. Once a thread is created, it will die within a certain period of time, but not instantly. When the search engine is active, the thread pool adjusts the number of threads predicting server load, so it's likely that you see the number of threads increase. Alkaline does that by increments. If the job queue is more than one single element, a thread is needed. Alkaline will spawn not 1, but up to 5 threads, which makes ramp-up time significantly better. The size of the thread pool is limited by the -mt command line option, but you should let Alkaline decide this number, unless you are experiencing server load problems. Typically, seeing an Alkaline with 5-6 threads with very infrequent searches is normal. It's expensive to create a thread, but not expensive to keep one around - the server is optimized for fast response.

Under some thread implementations, especially old Linux threads, due to the general one process per thread model, there's one process for the initial thread and N processes for the threads it created. The extra process that is seen corresponds to the thread manager thread, a thread created internally by the threads implementation to handle thread creation and thread termination. This extra thread is asleep most of the time.