JMeter vs UCF

Imagine that you need to perform load tests, but you have no money to buy HP LoadRunner licences, so you think that Apache JMeter is a good opensource alternative to HP LoadRunner – from my perspective this “genius” idea sounds weird, because the main advantage of HP LoadRunner is it’s analysis engine, though, my colleagues think it is possible to collect JMeter logs and process them using MS Excel, on the other hand I had never seen a proper HP LoadRunner report – performance guys always like to provide something like:

and I have no idea how to interpret such drawings 🙂

Well, we need to implement load scenarios using Apache JMeter and the main “challenge” is emulate content transfer “facilities” (did you know that UCF is acronym for “Unified Client Facilities”?). Actually it is not a challenge at all, all what you need is following:

  • if your JMeter instance is on UNIX you need to modify wdk/contentXfer/ucf.installer.config.xml on webtop side and remove dots before “ucf” in ucfHome and ucfInstallsHome elements – you need to get “$java{user.home}/Documentum/ucf” instead of “$java{user.home}/Documentum/.ucf”
  • download ucfinit.jar to JMeter host from webtop and execute
    java -cp ucfinit.jar com.documentum.ucf.client.install.TestInstall \
    http(s)://<host>:<port>/webtop /wdk/contentXfer/ucf.installer.config.xml
  • copy all files from ~/Documentum/ucf/<host>/shared/bin/<ucf version>/ directory to JMeter’s lib/ext directory
  • set CookieManager.save.cookies=true in jmeter.properties
  • create following groovy (JSR223) sampler:
    import com.documentum.ucf.client.transport.impl.ClientSession;
    import com.documentum.ucf.client.transport.requesthandlers.spi.BaseRequestHandler;
    import com.documentum.ucf.client.transport.IClientRequest;
    import com.documentum.ucf.client.transport.IResultPackage;
    import com.documentum.ucf.common.transport.IParameter;
    import com.documentum.ucf.client.transport.impl.BaseResultPackage;
    import com.documentum.ucf.common.transport.spi.BaseResponse;
    import com.documentum.ucf.client.transport.impl.RequestProcessor;
    import com.documentum.ucf.client.transport.requesthandlers.spi.RequestHandlerMismatchException;
    import org.apache.jmeter.threads.JMeterVariables;
    
    class LaunchApplicationHandler extends BaseRequestHandler {
    
      public IResultPackage process (IClientRequest request) throws RequestHandlerMismatchException {
        BaseResultPackage result = init(request);
        BaseResponse response = (BaseResponse) result.getResponse();
        return result;
      }
    	
    }
    
    class UCFHelper {
    
      static {
        RequestProcessor requestProcessor = ClientSession.s_requestProcessor;
        requestProcessor.addHandler("LaunchApplication", new LaunchApplicationHandler());
      }
    
      public static String getCookie(JMeterVariables vars) {
        String cookie = vars.get("COOKIE_JSESSIONID");
        return "JSESSIONID=" + cookie; 	
      }
    
      public static String getUrl(JMeterVariables vars) {
        return vars.get("WebtopProtocol") + "://" + vars.get("WebtopHostName") + ":" + vars.get("WebtopPort") + vars.get("WebtopContextRoot"); 	
      }
    
      public static void createUcfSession(JMeterVariables vars) {
        String cookie = getCookie(vars);
        ClientSession session = vars.getObject("UCFSESSION");
        boolean valid = session != null && session.isAlive();
        if (valid) {
          valid = cookie.equals(session.getSessionId());	
        }
        if (valid) {
          return;	
        }
        if (session != null) {
        	 session.interrupt();
        }
        session = new ClientSession(getUrl(vars), "Gair", cookie);	
        session.startSession();
        vars.putObject("UCFSESSION", session);
        vars.put("UCFKEY", session.getUID());	
      }
    	
    }
    
    UCFHelper.createUcfSession(vars);
    
    

voilà:

One thought on “JMeter vs UCF

  1. Pingback: Why CURSOR_SHARING=FORCE sucks | Documentum in a (nuts)HELL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s