Alter order of HR and lease lookup in allocation engine when looking for a free lease
Currently when the allocation engine is looking for lease candidates it does this:
- pickAddress
- check address for HR
- check address for existing lease
This can be expensive, particularly when HRs are in the a DB and leases are in memfile (arguably the most common use case). Once pools get full, we end up doing lots of HR lookups only to discover there is already a lease. If we decide in the other order, we at least have the ability to not waste cycles looking at HRs when there is already an existing lease.
It has been suggested, that we could tune this logic based on which might be more optimal:
HR Db / Memfile -> check lease then HR HR local / Memfile -> check lease then HR (one could argue either case) HR local / Lease DB -> check HR then lease
I'm skeptical that it would make a big difference. It matters almost as the ratio between address HRs to leases.
For the initial implementation, I am going to simply swap the order.
The impetus for this work is the following support ticket: