Reduce the time spent using the lock

Improve throughput performance