简体   繁体   English

使用Java,Web应用程序变得非常慢

[英]Web Application becomes very slow With Java

I am developing a Java Communication Gateway (CGW), where it gets data packet from GPS device, process it and store in one table called Live table(Database is running in different server - From Java CGW i called database connection through connection pool and insert data in Live table). 我正在开发一个Java Communication Gateway(CGW),它从GPS设备获取数据包,进行处理并将其存储在一个称为Live table的表中(数据库在不同的服务器中运行-从Java CGW,我通过连接池调用了数据库连接并插入实时表中的数据)。

On the other hand, Our web application is also reading data from same Live table. 另一方面,我们的Web应用程序也从同一Live表中读取数据。 Hence when Java CGW application starts web application becomes very very slow, even first page does not open. 因此,当Java CGW应用程序启动时,Web应用程序变得非常缓慢,甚至首页也无法打开。 I am using SQL server 2005. 我正在使用SQL Server 2005。

Please suggest me why it is happening. 请建议我为什么会这样。

Thanks in advance. 提前致谢。

Looks like your problem is a thread priority problem since reading / saving the data seems to take more processor time than expected, you could lower the thread priority by calling setPriority with a number lower than 5 in your current thread. 您的问题似乎是线程优先级问题,因为读取/保存数据似乎比预期花费了更多的处理器时间,因此可以通过在当前线程中使用小于5的数字来调用setPriority来降低线程优先级。

To get the current thread. 获取当前线程。

Thread.currentThread().setPriority(MIN_PRIORITY);

To know how to call it properly check out Set Priority method. 要知道如何正确调用它,请查看Set Priority方法。 hope this helps! 希望这可以帮助!

Have you done performance profiling of the DB server? 您是否已完成数据库服务器的性能分析? Maybe workload of the DB server is too heavy. 也许数据库服务器的工作量太重。 If Web application only reads the data, a master/slave database configuration should solve the DB server workload problem. 如果Web应用程序仅读取数据,则主/从数据库配置应解决DB服务器工作负载问题。

200 thread is a challenging number. 200线程是一个具有挑战性的数字。

  • What is the system architectural overview? 什么是系统架构概述?
  • How much memory is consumed for all of those threads. 所有这些线程消耗了多少内存。
  • How do you synchronize your data/communication between threads. 如何在线程之间同步数据/通信。
  • What is the hardware configuration. 什么是硬件配置。
  • Is it necessary to use SqlServer? 是否有必要使用SqlServer? the jdbc:odbc bridges could be slower than jdbc:mysql. jdbc:odbc网桥可能比jdbc:mysql慢。

Usually in multi-threading scenarios, communication overhead is exponential with respect to participating agents. 通常在多线程方案中,通信开销相对于参与的代理是指数级的。 Also, the way data is processed: same function for many data OR multiple functions / stages for multiple data types? 另外,数据的处理方式:对于许多数据使用相同的功能,还是对多种数据类型使用多个功能/阶段?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM