commit context per 0.5 seconds
save db every 500 iterations