简体   繁体   English

记录旧版Java应用程序的带宽使用情况

[英]Recording bandwidth usage of a legacy Java application

I know that there are a lot of threads on monitoring and/or limiting network bandwidth usage, but none of them provide a satisfactory answer. 我知道在监视和/或限制网络带宽使用方面有很多线程,但是它们都无法提供令人满意的答案。 Here is my problem: 这是我的问题:

I have a legacy java application which communicates to different servers (like HTTP and JMS). 我有一个遗留的Java应用程序,可以与不同的服务器通信(例如HTTP和JMS)。 My application can also receive incoming HTTP requests as well. 我的应用程序也可以接收传入的HTTP请求。 Now, this application is now supposed to be deployed in a cloud infrastructure to provide a SaaS model. 现在,现在应该将此应用程序部署在云基础架构中以提供SaaS模型。 The pricing model for the consumers is supposed to be based on the bandwidth flow in and out of the application. 消费者的定价模型应该基于流入和流出应用程序的带宽。

So, we need to device a way to count the number of bytes flowing in and out of the application through all sources (basically, all sockets that are created). 因此,我们需要一种方法来计算通过所有源(基本上是所创建的所有套接字)流入和流出应用程序的字节数。 The code base is huge and uses third party communication libraries in certain cases so active code changes are not possible everywhere. 代码库很大,在某些情况下使用第三方通信库,因此不可能在任何地方进行有效的代码更改。 Also, the application is a legacy java application supported on all platforms, the solution should be workable on all platforms as well. 此外,该应用程序是在所有平台上都受支持的旧版Java应用程序,该解决方案也应在所有平台上均适用。 I dont want to use third party external monitoring tools to do the job. 我不想使用第三方外部监视工具来完成这项工作。 Instead, need to find a solution which can be baked into the system, passively , to get the job done. 相反,需要找到可以被动地移植到系统中的解决方案以完成工作。

What are the ways/options/solutions to get this done? 完成这项工作的方式/选项/解决方案是什么? Any help is appreciated. 任何帮助表示赞赏。

You can create a TCP proxy server which sits between your application and the rest of the system. 您可以创建一个位于应用程序和系统其余部分之间的TCP代理服务器。 As long as this proxy server is used via configuration, it will see every byte coming in and out of your application. 只要通过配置使用此代理服务器,它将看到每个字节进出您的应用程序。 This way to can count or limit it how you like. 通过这种方式可以计算或限制您的喜好。

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

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