commit every 1000