dubbo consumer调用provider竟然需要5秒左右

姜龙 2015-07-24 02:47:25
zookeeper3.4.6作为注册中心 spring+dubbo tomcat作为容器 启动之后成功注册到zookeeper

consumer调用比较简单 只用java代码加载springxml文件 也可以调用成功 但是跟踪发现如下不可思议的地方:
DemoService demoService=(DemoService) context.getBean("demoService");这句代码竟然耗时5-6秒。目前为止没找出啥原因来

远程获取这一步能耗时这么久?太不正常了 求各位同仁指教
...全文
535 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq546937127 2015-07-24
  • 打赏
  • 举报
回复
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd" default-lazy-init="false"> 把default-lazy-init设置为false试一下,你没有设置这个,spring就延迟加载远程调用对象,所以花了很多时间去初始化对象了,

25,985

社区成员

发帖
与我相关
我的任务
社区描述
高性能WEB开发
社区管理员
  • 高性能WEB开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧