real-logic / aeron

Efficient reliable UDP unicast, UDP multicast, and IPC message transport
https://aeron.io
Apache License 2.0
7.42k stars 892 forks source link

[Java] Allow aeron archive client to reside behind a proxy #1658

Closed frantahaas closed 1 week ago

frantahaas commented 2 months ago

Hey, I'm currently using following workaround to have an Aeron archive client running behind a loadbalancer in k8s. Essentially, the AeronArchive does not allow me to specify a different channel to receive (subscribe) data (locally) and another channel (loadbalancer) that I want the Archive to actually send data to.

Would you allow something similar to this get integrated into the mainline? Or suggest a proper solution for my use-case? Thanks a lot

mikeb01 commented 2 months ago

While the feature is still experimental, you can look at using ResponseChannels to connect to the Archive.

frantahaas commented 2 months ago

Thanks for the reply. So, I've looked at those tests and tried something out which works locally but didn't manage to get it working in k8s.

Our topology is following:

Client <--- Proxy <--- Archive Client --------------> Archive

On the proxy, I've two ports open, one for the client control response 2022 and one for replay channel 2033.

How exactly am I supposed to configure the control on the Archive? In other terms, is the Archive supposed to have direct access to that uri? If so, does that actually help me in my case?

        final AeronArchive.Context aeronArchiveCtx = new AeronArchive.Context()
            .controlRequestChannel(archive.context().controlChannel())
            .controlResponseChannel("aeron:udp?control-mode=response|control=localhost/ClientIP/ProxyIP/ArchiveIP/:10002");

In my hack, I'm actually opening subscriptions on the Client's IP while sending Archive the Proxy's IP to publish response and replay to which gets fwded to Client.

vyazelenko commented 1 week ago

@frantahaas To use response channels feature you need configure control on the Archive to point to the Archive's IP.

final AeronArchive.Context aeronArchiveCtx = new AeronArchive.Context()
      .controlRequestChannel("aeron:udp?endpoint=ArchiveIP:10001")
      .controlResponseChannel("aeron:udp?control-mode=response|control=ArchiveIP:10002");