我们正在使用带有apache-tomcat(8.0.15)的websockets.tomcat在HAProxy后面运行,它有一个timeout server 60s.我们使用的是spring-websocket(4.1.4.RELEASE).我们面临的问题是会议不断频繁关闭.
我们在websocket客户端和服务器之间尝试了一个乒乓球,其中websocket客户端每隔30秒发送一次(ping)消息:
["SEND\ncallback_id:1449064876903\ndestination:/app/data/ping\ncontent-length:2\n\n{}\u0000"]
并且服务器以乒乓响应:
a["MESSAGE\ndestination:/user/topic\ncontent-type:application/json;charset=UTF-8\nsubscription:sub-1\nmessage-id:vkgme6t7-33577\ncontent-length:68\n\n{\"message\":\"pong\"}\u0000"]
不过,我们经常看到低于日志:
[SubProtocolWebSocketHandler] - No messages received after 60215 ms. Closing XhrStreamingSockJsSession[id=xxxx].
有什么想法有什么不对?
我遇到以下异常:
java.lang.NullPointerException
at javassist.util.proxy.RuntimeSupport$DefaultMethodHandler.invoke(RuntimeSupport.java:38)
at com.Customer_$$_javassist_1.getHibernateLazyInitializer(Customer_$$_javassist_1.java)
at org.hibernate.Hibernate.isInitialized(Hibernate.java:429)
at org.hibernate.engine.StatefulPersistenceContext.reassociateIfUninitializedProxy(StatefulPersistenceContext.java:530)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.reassociateIfUninitializedProxy(DefaultSaveOrUpdateEventListener.java:99)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:82)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:685)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:677)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:673)
at org.springframework.orm.hibernate3.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:740)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:737)
at com.HibernateCustomerService.create(HibernateCustomerService.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at sun.proxy.$Proxy62.create(Unknown Source)
Run Code Online (Sandbox Code Playgroud)
在中等/高负载下启动应用程序后,这往往会很快发生。类的进一步实例化com.Customer由于相同的异常而失败,因此该应用程序实际上被破坏了,直到我们重新启动为止。
我已经遍历了代码,但是由于将其设置在中,因此无法看到将如何DefaultMethodHandler调用theCustomer_$$_javassist_1它们JavassistLazyInitializer。
这是在带有Javassist 3.16.1的Hibernate 3.6.8-Final上
谁看过这个吗?有没有可能的解决方法?
我们目前正在评估apache-curator的分布式锁定用例.以下是我们的测试用例:
public class Test {
private static CuratorFramework client = CuratorFrameworkFactory.newClient("zook.company.com", new ExponentialBackoffRetry(10,5));
public static void main(String[] args) {
client.start();
int numLocks = 50000;
int numThreads = 200;
String[] keyPool = new String[numLocks];
for (int i = 1; i <= numLocks; i++) {
keyPool[i - 1] = String.valueOf(100 + i);
}
for (int i = 0; i < numThreads; i++) {
Thread t = new Thread(new Job(numLocks, keyPool));
t.setName("T" + (i + 1));
t.start();
}
}
private static class Job …Run Code Online (Sandbox Code Playgroud) 我们试图将下面的代码重构为java 8:
List<String> list = new ArrayList<>();
Iterator<Obj> i = x.iterator();
while (i.hasNext()) {
String y = m(i.next().getKey());
if (y != null) {
list.add(y);
}
}
return list;
Run Code Online (Sandbox Code Playgroud)
到目前为止,我们已经提出:
return x.stream().filter(s -> m(s.getKey()) != null).map(t -> m(t.getKey())).collect(Collectors.toList());
Run Code Online (Sandbox Code Playgroud)
但是这个方法m()在这里被调用了两次.有什么办法吗?
我们在Amazon EC2上设置了haproxy(v 1.5.1),它正在完成两项工作
我们服务器上的ulimit是128074,并发连接是~3000.
我们的配置文件如下所示.我们面临的问题是haproxy日志中的时间Tq非常高(2-3秒).配置或我们遗漏的东西有什么问题吗?
global
daemon
maxconn 64000
tune.ssl.default-dh-param 2048
log 127.0.0.1 local0 debug
defaults
mode http
option abortonclose
option forwardfor
option http-server-close
option httplog
timeout connect 9s
timeout client 60s
timeout server 30s
stats enable
stats uri /stats
stats realm Haproxy\ Statistics
stats auth username:nopass
frontend www-http
bind *:80
maxconn 64000
http-request set-header U-Request-Source %[src]
reqadd X-Forwarded-Proto:\ http
errorfile 503 /var/www/html/sorry.html
acl host_A hdr_dom(host) -f /etc/A.lst
acl host_B hdr_dom(host) -f /etc/B.lst
use_backend www-A if …Run Code Online (Sandbox Code Playgroud) 我需要检查一个字符串(电子邮件地址的本地部分)是否除了以下内容:
我该怎么做Java regex?
例如:a_1_b.c和a_b_1,应该没问题,但1.a_b.2并1_a*3应该被丢弃.
java ×2
amazon-ec2 ×1
haproxy ×1
hibernate ×1
java-8 ×1
java-stream ×1
javassist ×1
regex ×1
ssl ×1
tomcat8 ×1