[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Handle-info] debug slow resolution of handles



I took your handleResolve code and ran it in a loop as follows

        s.resolver.setCache(null); // don't use cache
        int COUNT = 100;
        long start = System.currentTimeMillis();
        for (int i = 0; i < COUNT; i++) { 
            s.handleResolve("10273/TEST/TEST3");
        }
        System.out.println((System.currentTimeMillis() - start) / COUNT);

I got 380ms average.

If I resolve your handle over and over again and watch the resolution time of each one, it is mostly under 300ms, but I have seen a couple of 10-second resolution times.  It seems to occur during the request-response cycle with your handle server itself.

Can you send me the access.log and error.log from your handle server?

Robert

On Feb 18, 2015, at 6:53 AM, Damian Ulbricht <ulbricht@gfz-potsdam.de> wrote:

> Hi,
> 
> we are running a handle server for prefix 10273 at host dc-app3-10.gfz-potsdam.de, currently 3.6 million handles registered. Registration and resolution of handles works - but both is  very slow (10 to 20 seconds, in some cases around 90 seconds).
> 
> To investigate the problem, I took the part of our program that resolves handles to URLs and discovered that it seems this slow in general (see inline JAVA code). I get answers in around 10 seconds for our prefix (10273) and for the two DataCite DOIs.
> 
> Since DataCite uses a different prefix and a different handle server, I wonder if I do something wrong? Does the HandleResolver class need a special setup to talk to our host (dc-app3-10.gfz-potsdam.de) directly?
> 
> 
> 
> Thanks
> Damian
> 
> 
> 
> ------
> 
> import java.nio.charset.Charset;
> import net.handle.hdllib.AbstractMessage;
> import net.handle.hdllib.AbstractResponse;
> import net.handle.hdllib.AdminRecord;
> import net.handle.hdllib.AuthenticationInfo;
> import net.handle.hdllib.CreateHandleRequest;
> import net.handle.hdllib.Encoder;
> import net.handle.hdllib.HandleResolver;
> import net.handle.hdllib.HandleValue;
> import net.handle.hdllib.ModifyValueRequest;
> import net.handle.hdllib.SecretKeyAuthenticationInfo;
> import org.apache.commons.lang.StringUtils;
> import java.security.PrivateKey;
> import net.handle.hdllib.PublicKeyAuthenticationInfo;
> import net.handle.hdllib.Util;
> import java.io.ByteArrayOutputStream;
> import java.io.InputStream;
> 
> public class  HandleService {
> 
> HandleResolver resolver = new HandleResolver();
> 
> public static void main(String[] args){
> 	
> 	HandleService s=new HandleService();
> 	try{
> 	System.out.println("--");		
> 	System.out.println(s.handleResolve("10273/TEST/TEST3"));
> 	System.out.println("--");		
> 	System.out.println(s.handleResolve("10273/TEST/TEST3"));
> 	System.out.println("--");		
> 	System.out.println(s.handleResolve("10.1594/GFZ.ISDC.CHAMP/CH-ME-2-ASC-BOOM"));		
> 	System.out.println("--");		
> 	System.out.println(s.handleResolve("10.1594/GFZ.ISDC.CHAMP/CH-ME-2-PLP"));				
> 	}catch(Exception e){
> 		System.out.println(e.getMessage());
> 	}
> }
> 
> private String handleResolve(String doi) throws Exception{
> 
>   try {
>      String[] types = { "URL" };
>      HandleValue[] values = resolver.resolveHandle(doi, types, null);
>      if (values.length == 0)
>          throw new Exception("no url found for handle " + doi);
>      return values[0].getDataAsString();
>   } catch (net.handle.hdllib.HandleException e) {
>      if (e.getCode() == net.handle.hdllib.HandleException.HANDLE_DOES_NOT_EXIST) {
>         throw new Exception("handle " + doi + " does not exist");
>      } else {
>           String message = "tried to resolve handle but failed: " + e.getMessage();
>                System.out.println(message);
>                throw new Exception(message, e);
>      }
>  }
> }
> }
> ------
> 
> 
> 
> -- 
> Damian Ulbricht
> Helmholtz Centre Potsdam
> GFZ German Research Centre For Geosciences
> Telegrafenberg, D-14473 Potsdam
> Phone: +49 331 288-2392
> 
> _______________________________________________
> Handle-Info mailing list
> Handle-Info@cnri.reston.va.us
> http://www.handle.net/mailman/listinfo/handle-info


_______________________________________________
Handle-Info mailing list
Handle-Info@cnri.reston.va.us
http://www.handle.net/mailman/listinfo/handle-info