Skip to content
Stu Arnett edited this page Mar 4, 2016 · 32 revisions

Maven coordinates:

Group Artifact Version
com.emc.ecs object-client 2.2.0

There are two ways to use the client: with or without the "Smart Client". If your system has a traditional load balancer set up behind a VIP, then use the URI constructor of S3Config. Note that virtual-host-style requests (where bucket.namespace is prepended to the host) are not enabled by default. To enable this, call setUseVHost(true).

If you want to use the software load balancer built-in to the client and have direct access to all the ECS nodes by IP, then use the alternate constructors of S3Config and the smart client will use the hosts you provide to discover all the ECS node IPs and load balance across them automatically.

S3Config config;

// with load balancer (and corresponding baseUrl/DNS setup)
config = new S3Config(new URI("https://s3.mycompany.com"));
// if you use virtual-host-style requests:
config.setUseVHost(true);

// client-side load balancing (direct to individual nodes)
// single VDC
config = new S3Config(Protocol.HTTP, NODE_IP1, NODE_IP2);
// multiple VDCs
config = new S3Config(Protocol.HTTP, new Vdc("Boston", VDC1_NODE1, VDC1_NODE2),
        new Vdc("Seattle", VDC2_NODE1, VDC2_NODE2));
// to enable geo-pinning (hashes the object key and pins it to a specific VDC)
config.setGeoPinningEnabled(true);

config.withIdentity(S3_ACCESS_KEY_ID).withSecretKey(S3_SECRET_KEY);

S3Client s3Client = new S3JerseyClient(config);

A note on performance

In high throughput environments (10GbE+), the apache client can be a bottleneck. To maximize performance in these situations, you can configure the client to use HttpURLConnection instead by using the optional constructor

S3Client s3Client = new S3JerseyClient(config, new URLConnectionClientHandler());

Note that this handler does not support Expect: 100-Continue behavior if that is important to you. However, we have witnessed a 5x throughput increase with a simultaneous .5x CPU load using this handler.

Clone this wiki locally