[ 
https://issues.apache.org/jira/browse/GEODE-2632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15977168#comment-15977168
 ] 

ASF GitHub Bot commented on GEODE-2632:
---------------------------------------

Github user kirklund commented on a diff in the pull request:

    https://github.com/apache/geode/pull/450#discussion_r112522440
  
    --- Diff: 
geode-core/src/jmh/java/org/apache/geode/internal/cache/tier/sockets/command/ClientCachePutBench.java
 ---
    @@ -0,0 +1,233 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
    + * agreements. See the NOTICE file distributed with this work for 
additional information regarding
    + * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance with the 
License. You may obtain a
    + * copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software 
distributed under the License
    + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 
ANY KIND, either express
    + * or implied. See the License for the specific language governing 
permissions and limitations under
    + * the License.
    + */
    +package org.apache.geode.internal.cache.tier.sockets.command;
    +
    +import static java.lang.System.*;
    +import static java.util.concurrent.TimeUnit.*;
    +import static org.apache.commons.io.FileUtils.*;
    +import static org.apache.commons.lang.StringUtils.*;
    +import static org.apache.geode.cache.client.ClientRegionShortcut.*;
    +import static org.apache.geode.distributed.AbstractLauncher.Status.*;
    +import static org.apache.geode.distributed.ConfigurationProperties.*;
    +import static org.apache.geode.distributed.internal.DistributionConfig.*;
    +import static org.apache.geode.internal.AvailablePort.*;
    +import static org.apache.geode.test.dunit.NetworkUtils.*;
    +import static org.assertj.core.api.Assertions.*;
    +import static org.awaitility.Awaitility.*;
    +
    +import org.apache.geode.cache.Region;
    +import org.apache.geode.cache.client.ClientCache;
    +import org.apache.geode.cache.client.ClientCacheFactory;
    +import org.apache.geode.distributed.ServerLauncher;
    +import org.apache.geode.internal.process.ProcessStreamReader;
    +import org.junit.rules.TemporaryFolder;
    +import org.openjdk.jmh.annotations.Benchmark;
    +import org.openjdk.jmh.annotations.BenchmarkMode;
    +import org.openjdk.jmh.annotations.Fork;
    +import org.openjdk.jmh.annotations.Level;
    +import org.openjdk.jmh.annotations.Measurement;
    +import org.openjdk.jmh.annotations.Mode;
    +import org.openjdk.jmh.annotations.OutputTimeUnit;
    +import org.openjdk.jmh.annotations.Scope;
    +import org.openjdk.jmh.annotations.Setup;
    +import org.openjdk.jmh.annotations.State;
    +import org.openjdk.jmh.annotations.TearDown;
    +import org.openjdk.jmh.annotations.Warmup;
    +
    +import java.io.File;
    +import java.io.IOException;
    +import java.net.URL;
    +import java.util.ArrayList;
    +import java.util.List;
    +import java.util.Random;
    +import java.util.concurrent.TimeUnit;
    +
    +/**
    + * Benchmark that measures throughput of single-threaded client performing 
puts to a loner server.
    + * <p>
    + * 100 random keys and values are generated during setup and the client 
reuses these in order,
    + * looping back around after 100 puts.
    + */
    +@Measurement(iterations = 3, time = 2, timeUnit = MINUTES)
    +@Warmup(iterations = 1, time = 1, timeUnit = MINUTES)
    +@Fork(3)
    +@BenchmarkMode(Mode.Throughput)
    +@OutputTimeUnit(TimeUnit.SECONDS)
    +@State(Scope.Thread)
    +@SuppressWarnings("unused")
    +public class ClientCachePutBench {
    +
    +  static final String CLASS_NAME = 
ClientCachePutBench.class.getSimpleName();
    +  static final String PACKAGE_NAME =
    +      replace(ClientCachePutBench.class.getPackage().getName(), ".", "/");
    +  static final String REGION_NAME = CLASS_NAME + "-region";
    +  static final String SERVER_XML_NAME = "/" + PACKAGE_NAME + "/" + 
CLASS_NAME + "-server.xml";
    +  static final long PROCESS_READER_TIMEOUT = 60 * 1000;
    +  static final int NUMBER_OF_KEYS = 100;
    +  static final int NUMBER_OF_VALUES = 100;
    +
    +  @State(Scope.Benchmark)
    +  public static class ClientState {
    +
    +    Region<String, String> region;
    +
    +    String[] keys;
    +    String[] values;
    +
    +    private int keyIndex = -1;
    +    private int valueIndex = -1;
    +
    +    private Process process;
    +    private volatile ProcessStreamReader processOutReader;
    +    private volatile ProcessStreamReader processErrReader;
    +
    +    private int serverPort;
    +    private ServerLauncher launcher;
    +    private File serverDirectory;
    +    private ClientCache clientCache;
    +
    +    private TemporaryFolder temporaryFolder = new TemporaryFolder();
    +
    +    @Setup(Level.Trial)
    +    public void startServer() throws Exception {
    +      System.out.println("\n" + "[ClientCachePutBench] startServer");
    +
    +      Random random = new Random(nanoTime());
    +      this.keys = createStrings("KEY-", NUMBER_OF_KEYS, random);
    +      this.values = createStrings("VAL-", NUMBER_OF_VALUES, random);
    +
    +      this.temporaryFolder.create();
    +      this.serverDirectory = this.temporaryFolder.getRoot();
    +
    +      this.serverPort = getRandomAvailablePort(SOCKET);
    +      this.process = startServerProcess(this.serverDirectory, 
this.serverPort);
    +
    +      try {
    +        startProcessReaders(this.process);
    +
    +        ServerLauncher serverLauncher = new ServerLauncher.Builder()
    +            
.setWorkingDirectory(this.serverDirectory.getAbsolutePath()).build();
    +
    +        await("Starting server in " + this.serverDirectory).atMost(2, 
MINUTES)
    +            .until(() -> 
assertThat(serverLauncher.status().getStatus()).isEqualTo(ONLINE));
    +
    +        this.clientCache = new ClientCacheFactory().set(LOG_LEVEL, "warn")
    +            .addPoolServer(getIPLiteral(), this.serverPort).create();
    +        this.region =
    +            this.clientCache.<String, 
String>createClientRegionFactory(PROXY).create(REGION_NAME);
    +
    +      } finally {
    +        stopProcessReaders(PROCESS_READER_TIMEOUT);
    --- End diff --
    
    Yes, these process readers are in the Client JVM and thus can impact 
performance. They really only exist to provide details if the server fails to 
startup during setup. After that as long as the client connects and is able to 
put, then it doesn't matter. We have plenty of tests (including grep for 
suspect strings) that monitor server output during/after testing.


> Integrated Security performance improvements
> --------------------------------------------
>
>                 Key: GEODE-2632
>                 URL: https://issues.apache.org/jira/browse/GEODE-2632
>             Project: Geode
>          Issue Type: Improvement
>          Components: security
>            Reporter: Jinmei Liao
>            Assignee: Kirk Lund
>              Labels: performance
>
> There is a security check in Put65.cmdExecute() that, if removed, improved 
> the performance.
> The expense of this security call needs to be reduced in order to get the 
> performance back.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to