Пример #1
0
        /// <summary>Run MiniBenchmark using delegation token authentication.</summary>
        /// <param name="conf">- configuration</param>
        /// <param name="count">- connect this many times</param>
        /// <param name="keytabKey">- key for keytab file in the configuration</param>
        /// <param name="userNameKey">- key for user name in the configuration</param>
        /// <returns>average time to connect</returns>
        /// <exception cref="System.IO.IOException"/>
        internal virtual long RunMiniBenchmarkWithDelegationToken(Configuration conf, int
                                                                  count, string keytabKey, string userNameKey)
        {
            // get login information
            string user = Runtime.GetProperty("user.name");

            if (userNameKey != null)
            {
                user = conf.Get(userNameKey, user);
            }
            string keytabFile = null;

            if (keytabKey != null)
            {
                keytabFile = conf.Get(keytabKey, keytabFile);
            }
            MiniRPCBenchmark.MiniServer miniServer = null;
            UserGroupInformation.SetConfiguration(conf);
            string shortUserName = UserGroupInformation.CreateRemoteUser(user).GetShortUserName
                                       ();

            try
            {
                conf.SetStrings(DefaultImpersonationProvider.GetTestProvider().GetProxySuperuserGroupConfKey
                                    (shortUserName), GroupName1);
                ConfigureSuperUserIPAddresses(conf, shortUserName);
                // start the server
                miniServer = new MiniRPCBenchmark.MiniServer(conf, user, keytabFile);
                IPEndPoint addr = miniServer.GetAddress();
                ConnectToServerAndGetDelegationToken(conf, addr);
                // connect to the server count times
                SetLoggingLevel(logLevel);
                long elapsed = 0L;
                for (int idx = 0; idx < count; idx++)
                {
                    elapsed += ConnectToServerUsingDelegationToken(conf, addr);
                }
                return(elapsed);
            }
            finally
            {
                if (miniServer != null)
                {
                    miniServer.Stop();
                }
            }
        }
Пример #2
0
        /// <summary>Run MiniBenchmark with MiniServer as the RPC server.</summary>
        /// <param name="conf">- configuration</param>
        /// <param name="count">- connect this many times</param>
        /// <param name="keytabKey">- key for keytab file in the configuration</param>
        /// <param name="userNameKey">- key for user name in the configuration</param>
        /// <returns>average time to connect</returns>
        /// <exception cref="System.IO.IOException"/>
        internal virtual long RunMiniBenchmark(Configuration conf, int count, string keytabKey
                                               , string userNameKey)
        {
            // get login information
            string user = Runtime.GetProperty("user.name");

            if (userNameKey != null)
            {
                user = conf.Get(userNameKey, user);
            }
            string keytabFile = null;

            if (keytabKey != null)
            {
                keytabFile = conf.Get(keytabKey, keytabFile);
            }
            MiniRPCBenchmark.MiniServer miniServer = null;
            try
            {
                // start the server
                miniServer = new MiniRPCBenchmark.MiniServer(conf, user, keytabFile);
                IPEndPoint addr = miniServer.GetAddress();
                ConnectToServer(conf, addr);
                // connect to the server count times
                SetLoggingLevel(logLevel);
                long elapsed = 0L;
                for (int idx = 0; idx < count; idx++)
                {
                    elapsed += ConnectToServer(conf, addr);
                }
                return(elapsed);
            }
            finally
            {
                if (miniServer != null)
                {
                    miniServer.Stop();
                }
            }
        }