打开淡褐色时表现缓慢

问题描述 投票:-2回答:2

打开淡褐色时表现缓慢。

我是hazelcast服务的新手,需要一些帮助。希望来自专家的一些回复。

对象指的是,当客户端点击下面的图表时,HTTP呼叫的响应缓慢400%(2秒)。 https://drive.google.com/open?id=0ByIpkcJW-nHLVHJWRzJkOHFPdkE

如果其中一个淡褐色关闭,则响应更快(500毫秒)

HTTP restful services调用返回大约3k个结果。

有关设置的任何建议可以解决性能问题吗?或者设置有问题

以下是有关休息服务的其他信息。

HTTP URL and response data

URL: http://10.1.1.1/data/api/zipcode



 {"content":[{"resourceId":0,"version":0,"name":"00000","deleted":false,"defaultFlag":false,"cityId":0,"active":true},
{"resourceId":1,"version":0,"name":"01000","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":4,"version":0,"name":"01500","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":5,"version":0,"name":"01502","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":6,"version":0,"name":"01503","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":7,"version":0,"name":"01504","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":8,"version":0,"name":"01505","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":9,"version":0,"name":"01506","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":10,"version":0,"name":"01508","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":11,"version":0,"name":"01512","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":12,"version":0,"name":"01514","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":13,"version":0,"name":"01516","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":14,"version":0,"name":"01517","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":15,"version":0,"name":"01518","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":16,"version":0,"name":"01524","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":17,"version":0,"name":"01529","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":18,"version":0,"name":"01532","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":19,"version":0,"name":"01538","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":20,"version":0,"name":"01540","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":21,"version":0,"name":"01546","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":22,"version":0,"name":"01550","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":23,"version":0,"name":"01551","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":24,"version":0,"name":"01556","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":25,"version":0,"name":"01560","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
{"resourceId":26,"version":0,"name":"01564","deleted":false,"defaultFlag":false,"cityId":1,"active":true},
...
{"resourceId":3000,"version":0,"name":"01564","deleted":false,"defaultFlag":false,"cityId":1,"active":true}

hazelcast.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2008-2015, Hazelcast, Inc. All Rights Reserved.
  ~
  ~ Licensed 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.
  -->

<!--
    The default Hazelcast configuration. This is used when:

    - no hazelcast.xml if present

-->
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.5.xsd"
           xmlns="http://www.hazelcast.com/schema/config"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <group>
        <name>dev</name>
        <password>dev-pass</password>
    </group>
    <management-center enabled="true">http://localhost:8080/mancenter</management-center>
    <network>
        <port auto-increment="true" port-count="100">5701</port>
        <outbound-ports>
            <!--
            Allowed port range when connecting to other nodes.
            0 or * means use system provided port.
            -->
            <ports>0</ports>
        </outbound-ports>
        <join>
            <multicast enabled="true">
                <multicast-group>224.2.2.3</multicast-group>
                <multicast-port>54327</multicast-port>
            </multicast>
            <tcp-ip enabled="false">
                <interface>127.0.0.1</interface>
                <member-list>
                    <member>127.0.0.1</member>
                </member-list>
            </tcp-ip>
            <aws enabled="false">
                <access-key>my-access-key</access-key>
                <secret-key>my-secret-key</secret-key>
                <!--optional, default is us-east-1 -->
                <region>us-west-1</region>
                <!--optional, default is ec2.amazonaws.com. If set, region shouldn't be set as it will override this property -->
                <host-header>ec2.amazonaws.com</host-header>
                <!-- optional, only instances belonging to this group will be discovered, default will try all running instances -->
                <security-group-name>hazelcast-sg</security-group-name>
                <tag-key>type</tag-key>
                <tag-value>hz-nodes</tag-value>
            </aws>
        </join>
        <interfaces enabled="false">
            <interface>10.10.1.*</interface>
        </interfaces>
        <ssl enabled="false"/>
        <socket-interceptor enabled="false"/>
        <symmetric-encryption enabled="false">
            <!--
               encryption algorithm such as
               DES/ECB/PKCS5Padding,
               PBEWithMD5AndDES,
               AES/CBC/PKCS5Padding,
               Blowfish,
               DESede
            -->
            <algorithm>PBEWithMD5AndDES</algorithm>
            <!-- salt value to use when generating the secret key -->
            <salt>thesalt</salt>
            <!-- pass phrase to use when generating the secret key -->
            <password>thepass</password>
            <!-- iteration count to use when generating the secret key -->
            <iteration-count>19</iteration-count>
        </symmetric-encryption>
    </network>
    <partition-group enabled="false"/>
    <executor-service name="default">
        <pool-size>16</pool-size>
        <!--Queue capacity. 0 means Integer.MAX_VALUE.-->
        <queue-capacity>0</queue-capacity>
    </executor-service>
    <queue name="default">
        <!--
            Maximum size of the queue. When a JVM's local queue size reaches the maximum,
            all put/offer operations will get blocked until the queue size
            of the JVM goes down below the maximum.
            Any integer between 0 and Integer.MAX_VALUE. 0 means
            Integer.MAX_VALUE. Default is 0.
        -->
        <max-size>0</max-size>
        <!--
            Number of backups. If 1 is set as the backup-count for example,
            then all entries of the map will be copied to another JVM for
            fail-safety. 0 means no backup.
        -->
        <backup-count>1</backup-count>

        <!--
            Number of async backups. 0 means no backup.
        -->
        <async-backup-count>0</async-backup-count>

        <empty-queue-ttl>-1</empty-queue-ttl>
    </queue>
    <map name="default">
        <!--
           Data type that will be used for storing recordMap.
           Possible values:
           BINARY (default): keys and values will be stored as binary data
           OBJECT : values will be stored in their object forms
           NATIVE : values will be stored in non-heap region of JVM
        -->
        <in-memory-format>BINARY</in-memory-format>

        <!--
            Number of backups. If 1 is set as the backup-count for example,
            then all entries of the map will be copied to another JVM for
            fail-safety. 0 means no backup.
        -->
        <backup-count>1</backup-count>
        <read-backup-data>false</read-backup-data>
        <!--
            Number of async backups. 0 means no backup.
        -->
        <async-backup-count>0</async-backup-count>
        <!--
            Maximum number of seconds for each entry to stay in the map. Entries that are
            older than <time-to-live-seconds> and not updated for <time-to-live-seconds>
            will get automatically evicted from the map.
            Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
        -->
        <time-to-live-seconds>0</time-to-live-seconds>
        <!--
            Maximum number of seconds for each entry to stay idle in the map. Entries that are
            idle(not touched) for more than <max-idle-seconds> will get
            automatically evicted from the map. Entry is touched if get, put or containsKey is called.
            Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
        -->
        <max-idle-seconds>0</max-idle-seconds>
        <!--
            Valid values are:
            NONE (no eviction),
            LRU (Least Recently Used),
            LFU (Least Frequently Used).
            NONE is the default.
        -->
        <eviction-policy>NONE</eviction-policy>
        <!--
            Maximum size of the map. When max size is reached,
            map is evicted based on the policy defined.
            Any integer between 0 and Integer.MAX_VALUE. 0 means
            Integer.MAX_VALUE. Default is 0.
        -->
        <max-size policy="PER_NODE">0</max-size>
        <!--
            When max. size is reached, specified percentage of
            the map will be evicted. Any integer between 0 and 100.
            If 25 is set for example, 25% of the entries will
            get evicted.
        -->
        <eviction-percentage>100</eviction-percentage>
        <!--
            Minimum time in milliseconds which should pass before checking
            if a partition of this map is evictable or not.
            Default value is 100 millis.
        -->
        <min-eviction-check-millis>100</min-eviction-check-millis>
        <!--
            While recovering from split-brain (network partitioning),
            map entries in the small cluster will merge into the bigger cluster
            based on the policy set here. When an entry merge into the
            cluster, there might an existing entry with the same key already.
            Values of these entries might be different for that same key.
            Which value should be set for the key? Conflict is resolved by
            the policy set here. Default policy is PutIfAbsentMapMergePolicy

            There are built-in merge policies such as
            com.hazelcast.map.merge.PassThroughMergePolicy; entry will be overwritten if merging entry exists for the key.
            com.hazelcast.map.merge.PutIfAbsentMapMergePolicy ; entry will be added if the merging entry doesn't exist in the cluster.
            com.hazelcast.map.merge.HigherHitsMapMergePolicy ; entry with the higher hits wins.
            com.hazelcast.map.merge.LatestUpdateMapMergePolicy ; entry with the latest update wins.
        -->
        <merge-policy>com.hazelcast.map.merge.PassThroughMergePolicy</merge-policy>

    </map>

    <multimap name="default">
        <backup-count>1</backup-count>
        <value-collection-type>SET</value-collection-type>
    </multimap>

    <list name="default">
        <backup-count>1</backup-count>
    </list>

    <set name="default">
        <backup-count>1</backup-count>
    </set>

    <jobtracker name="default">
        <max-thread-size>0</max-thread-size>
        <!-- Queue size 0 means number of partitions * 2 -->
        <queue-size>0</queue-size>
        <retry-count>0</retry-count>
        <chunk-size>1000</chunk-size>
        <communicate-stats>true</communicate-stats>
        <topology-changed-strategy>CANCEL_RUNNING_OPERATION</topology-changed-strategy>
    </jobtracker>

    <semaphore name="default">
        <initial-permits>0</initial-permits>
        <backup-count>1</backup-count>
        <async-backup-count>0</async-backup-count>
    </semaphore>

    <!--reliable-topic name="default">
        <read-batch-size>10</read-batch-size>
        <topic-overload-policy>BLOCK</topic-overload-policy>
        <statistics-enabled>true</statistics-enabled>
    </reliable-topic>

    <ringbuffer name="default">
        <capacity>10000</capacity>
        <backup-count>1</backup-count>
        <async-backup-count>0</async-backup-count>
        <time-to-live-seconds>30</time-to-live-seconds>
        <in-memory-format>BINARY</in-memory-format>
    </ringbuffer-->

    <serialization>
        <portable-version>0</portable-version>
    </serialization>

    <services enable-defaults="true"/>

</hazelcast>

hazelcast.config

JAVA_OPTS=" -server -Xms3000m -Xmx3000m -d64 -cp /opt/hazelcast/compile/hazelcast-3.5.5.jar:/opt/hazelcast/compile/hazelcast-client-3.5.5.jar:/opt/hazelcast/compile/hazelcast-hibernate4-3.5.5.jar:/opt/hazelcast/provided/annotations-1.3.2.jar:/opt/hazelcast/provided/antlr-2.7.7.jar:/opt/hazelcast/provided/cache-api-1.0.0.jar:/opt/hazelcast/provided/dom4j-1.6.1.jar:/opt/hazelcast/provided/hibernate-commons-annotations-4.0.5.Final.jar:/opt/hazelcast/provided/hibernate-core-4.3.8.Final.jar:/opt/hazelcast/provided/hibernate-jpa-2.1-api-1.0.0.Final.jar:/opt/hazelcast/provided/jandex-1.1.0.Final.jar:/opt/hazelcast/provided/javassist-3.18.1-GA.jar:/opt/hazelcast/provided/jboss-logging-3.1.3.GA.jar:/opt/hazelcast/provided/jboss-logging-annotations-1.2.0.Beta1.jar:/opt/hazelcast/provided/jboss-transaction-api_1.2_spec-1.0.0.Final.jar:/opt/hazelcast/provided/xml-apis-1.0.b2.jar -Dhazelcast.config=/etc/hazelcast/hazelcast.xml -Dhazelcast.jmx=true"

Hazel cast mancenter info

Number of Processors:   4
Start Time: Sat Oct 21 15:56:11 MYT 2017
Up Time:    0 days, 0 hours, 0 minutes, 15 seconds
Maximum Memory: 2.81 GB
Total Memory:   2.81 GB
Free Memory:    2.45 GB
Used Heap Memory:   363.41 MB
Max Heap Memory:    2.81 GB
Used Non-Heap Memory:   24.47 MB
Max Non-Heap Memory:    214 MB
Total Loaded Classes:   4578
Current Loaded Classes: 4578
Total Unloaded Classes: 0
Total Thread Count: 40
Active Thread Count:    39
Peak Thread Count:  39
Daemon Thread Count:    5
OS: Free Physical Memory:   2.81 GB
OS: Committed Virtual Memory:   5.44 GB
OS: Total Physical Memory:  7.64 GB
OS: Free Swap Space:    16 GB
OS: Total Swap Space:   16 GB
OS: Maximum File Descriptor Count:  4096
OS: Open File Descriptor Count: 57
OS: Process CPU Time:   0 days, 0 hours, 0 minutes, 7 seconds
OS: Process CPU Load:   4.0 %
OS: System Load Average:    25.0 %
OS: System CPU Load:    4.0 %

Key and Data Structure

import java.util.Date;
import java.util.Objects;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.validator.constraints.NotBlank;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

/**
 * <p>PostCode class.</p>
 *
 * @since 1.0.0
 */
@Entity
@Table(name = "REF_POSTCODE",
       uniqueConstraints = {@UniqueConstraint(columnNames = { "name", "city_id", "deleted_date" }) },
       indexes = { @Index(columnList = "city_id"),
                   @Index(columnList = "name")})
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE,
       region = "my.xxxxx.lookup.entity.PostCode")
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
@Getter @Setter @AllArgsConstructor @NoArgsConstructor @ToString(callSuper = true)
public class PostCode extends AbstractEntity<Integer> {

    /** Constant <code>serialVersionUID=-8547924718051529341L</code> */
    private static final long serialVersionUID = -8547924718051529341L;

    @Id
    @Access(AccessType.PROPERTY)
    @TableGenerator(name = APP_SEQ_GENERATOR, table = APP_SEQ_TABLE, pkColumnName = SEQ_NAME_COL, pkColumnValue = "postCode.ID", valueColumnName = SEQ_VAL_COL, initialValue = INITIAL_VALUE, allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.TABLE, generator = APP_SEQ_GENERATOR)
    private Integer id;

    @NotBlank
    @Size(max = 100)
    @Column(nullable = false, length = 100)
    private String name;

    @Size(max = 500)
    @Column(length = 500)
    private String desp;

    @Column(name = "IS_DELETED")
    private boolean isDeleted = Boolean.FALSE;

    @Column(name = "DELETED_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date deletedDate = EPOCH_DATE_TIME;

    @Column(name = "DEFAULT_FLAG")
    private boolean defaultFlag;

    @Column(name = "PREV_VERSION_ID")
    private Integer prevVersionId;

    @NotNull
    @Column(name = "IS_ACTIVE", nullable = false, columnDefinition="BOOLEAN DEFAULT TRUE")
    private boolean isActive = Boolean.TRUE;

    @NotNull
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    @JoinColumn(name = "CITY_ID", nullable = false)
    private City city;

    @Override
    public int hashCode() {
        if(null != this.id){
            return Objects.hash(this.id);
        }
        return Objects.hash(this.getName(), this.getDeletedDate());
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (obj instanceof PostCode) {
            PostCode other = (PostCode) obj;
            return Objects.equals(this.hashCode(), other.hashCode());
        }
        return false;
    }

}

Persistence.properties

# Hibernate distributed secondary (L2) cache
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=true
hibernate.cache.use_minimal_puts=true
hibernate.cache.region.factory_class=com.hazelcast.hibernate.HazelcastCacheRegionFactory
hibernate.cache.use_structured_entries=true
hibernate.cache.hazelcast.use_native_client=true
hibernate.cache.hazelcast.native_client_address=10.1.2.1 

LOgfile

Hazelcast日志文件 https://drive.google.com/open?id=0ByIpkcJW-nHLZjhyZEJ2a2RPSDQ

hazelcast Threaddump https://drive.google.com/open?id=0ByIpkcJW-nHLMDdlQ0VWaU1taDA

tomcat线程转储 qazxsw poi

Version

JDK 1.8 Hazel铸造3.5

java performance hazelcast
2个回答
2
投票

除了使用非常旧版本的Hazelcast之外,我找不到任何明显的配置问题。我建议你将Hazelcast和hazelcast-hibernate更新到最新版本,看看会发生什么。


0
投票

在这里提高性能的几点建议

  1. 运行3个节点的最小集群
  2. 如果数据大部分是只读的,则将read-from-backup设置为true
  3. 尽可能启用近缓存。
  4. 根据您的硬件调整hazelcast线程计数和分区。 (详情请参阅参考手册)https://drive.google.com/open?id=0ByIpkcJW-nHLZE5JamptdUNuZm8
  5. 确保将客户端配置为智能客户端
© www.soinside.com 2019 - 2024. All rights reserved.