The overhead is minimal, it only happens when adding or removing
hosts, even if you have thousands on backend nodes that are changing
all the time it is incredibly unlikely there will ever be a measurable
difference (also this only makes a real difference for additions,
removals are still O(n), so if you are using a proxy with thousands of
backend nodes that are added and removed multiple times per second a
List is not the ideal structure anyway).
The real issue though is that your approach is not thread safe, so
adding or removing a host could cause incoming requests to fail with a
ConcurrentModificationException if the HostSelector attempts to
iterate the host. The solution to this would be to use a thread safe
list, which will either incur the same copy cost (with
CopyOnWriteArrayList) or add runtime overhead (if some kind of
synchronized List is used) that has the potential to significantly
degrade the performance of the proxy.
On Fri, May 12, 2017 at 8:28 PM, anurag singhal
Thanks for responding.
Yes I agree there are methods available for adding host. My suggestion was
regarding using list as it will remove the overhead of array copy and
related operations in both add and remove host.
On 12 May 2017 8:37 a.m., "Stuart Douglas" <sdouglas(a)redhat.com> wrote:
You already can add hosts on the fly, using the
java.lang.String, org.xnio.ssl.XnioSsl) method.
On Wed, Apr 19, 2017 at 4:41 PM, anurag singhal
> Hi Team,
> Kindly find the suggested change. Instead of array used list for hosts.
> gives flexibility to add hosts on the fly.
> With Regards
> Anurag Singhal