对于第一次请求,Dropwizard响应时间很慢

时间:2018-02-07 14:02:17

标签: java dropwizard

我正在使用dropwizard 1.0.2。我观察第一个请求的响应时间约为5.5秒,然后后续请求大约需要1秒。

问题类似于所讨论的问题here

有人可以告诉我这是否是预期的?如果是,那么有解决方法吗?

如果没有预料到,有人可以告诉我如何在dropwizard中记录请求处理的各个阶段的时间?

我已经验证了资源类中的时间(这是在大约800毫秒内返回响应)

1 个答案:

答案 0 :(得分:0)

也许E/AndroidRuntime: FATAL EXCEPTION: main Process: kr.cds.jisulife, PID: 8226 java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Integer.java:483) at java.lang.Integer.valueOf(Integer.java:611) at kr.cds.jisulife.BrainWhoIndex.getGradeToString(BrainWhoIndex.java:36) at kr.cds.jisulife.WeatherFragment$ListViewAdapter.getView(WeatherFragment.java:452) at android.widget.AbsListView.obtainView(AbsListView.java:2363) at android.widget.ListView.measureHeightOfChildren(ListView.java:1326) at android.widget.ListView.onMeasure(ListView.java:1233) at android.view.View.measure(View.java:19857) at android.support.constraint.ConstraintLayout.internalMeasureChildren(ConstraintLayout.java:934) at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:973) at android.view.View.measure(View.java:19857) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) at android.view.View.measure(View.java:19857) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083) at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:714) at android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:90) at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1391) at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:784) at android.view.View.measure(View.java:19857) at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:1081) at android.view.View.measure(View.java:19857) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139) at android.view.View.measure(View.java:19857) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464) at android.widget.LinearLayout.measureVertical(LinearLayout.java:758) at android.widget.LinearLayout.onMeasure(LinearLayout.java:640) at android.view.View.measure(View.java:19857) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.view.View.measure(View.java:19857) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464) at android.widget.LinearLayout.measureVertical(LinearLayout.java:758) at android.widget.LinearLayout.onMeasure(LinearLayout.java:640) at android.view.View.measure(View.java:19857) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at com.android.internal.policy.DecorView.onMeasure(DecorView.java:689) at android.view.View.measure(View.java:19857) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2275) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1366) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1619) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6337) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874) at android.view.Choreographer.doCallbacks(Choreographer.java:686) at android.view.Choreographer.doFrame(Choreographer.java:621) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 对资源类使用延迟初始化。 您可以在资源的构造函数上添加断点,以检查在启动期间或第一次请求时是否调用它。