Harish, ConnectionTimeout and RequestTimeout are actual socket operations on the client side. Specifically, the first is passed to the actual connect() call and the second sets the SO_TIMEOUT (SO_RCVTIMEO) socket option so that the (blocking) read will time out.
The latter was included because in the past (pre 1.4) Riak did not have operation timeouts; the only way to abort an operation was to time out the socket read on the client side and dump the connection (ugly, and expensive). I double-checked the client code in the debugger and the client is indeed passing the timeout all the way down to the protocol buffer and it's being sent over the wire. What is happening is that your fetch request is being serviced in Riak within 1ms. As a point of reference, in order to trigger a Riak-side timeout when fetching on my machine with that 1ms timeout I had to store a 5MB object. Thanks, - Roach On Wed, Nov 20, 2013 at 4:20 AM, Harish Sharma <[email protected]> wrote: > FetchObject has a timeout method - > > /** > > * Set an operation timeout in milliseconds to be sent to Riak > > * > > * As of 1.4 Riak allows a timeout to be sent for get, put, and delete > operations. > > * The client will receive a timeout error if the operation is not > completed > > * within the specified time > > * @param timeout the timeout in milliseconds > > * @return this > > */ > > > > public FetchObject<T> timeout(int timeout) { > > builder.timeout(timeout); > > return this; > > } > > > > But it doesn’t work, I am using as following > > > > FetchObject<IRiakObject> fo= xBucket.fetch("0.10717155098162867"); > > > > IRiakObject iRiakObject =fo.timeout(1).execute(); > > > > Other timeouts like ConnectionTimeout and RequestTimeout work perfect but > timeout on fetch object with execute has no effect in my case it takes 31 > miliseconds to fetch and I have a timeout of 1 ms but I see no error., What > I am missing here? > > > > FYI, I am making client as per following – > > > > private static IRiakClient setupRiakClusterClient() { > > IRiakClient client = null; > > try { > > String riakClusteHost2 = "10.200.2.58"; > > > > int riakClusterPort = 8087; > > > > int riakIntialPoolSize = 10; > > int riakMaxPoolSize = 200; > > int riakConnectionTimeoutMillis = 10; > > int riakRequestTimeoutMillis = 2; > > > > PBClusterConfig clusterConfig = new > PBClusterConfig(riakMaxPoolSize); > > PBClientConfig pbconfig = new > PBClientConfig.Builder().withPort(riakClusterPort).withInitialPoolSize(riakIntialPoolSize).withPoolSize(riakMaxPoolSize).withConnectionTimeoutMillis(riakConnectionTimeoutMillis).withRequestTimeoutMillis(riakRequestTimeoutMillis).withIdleConnectionTTLMillis(1).build(); > > > > clusterConfig.addHosts(pbconfig, riakClusteHost2); > > client = RiakFactory.newClient(clusterConfig); > > > > } catch (RiakException e) { > > e.printStackTrace(); > > System.exit(1); > > } > > return client; > > } > > > _______________________________________________ > riak-users mailing list > [email protected] > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > _______________________________________________ riak-users mailing list [email protected] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
