sophia: introduce scheduler

This patch completes works done with sharing resources
from per-database model to envrionment and scheduler
aware.

From this point log pool and thread pool are under
environment control.

Scheduler is responsible for planning
background service tasks. Future patches will make it work
in the most efficient way.
Eg. use statistics, account load changes, change
tasks priorities online, etc.