Bitcoin Forum
November 18, 2017, 11:45:29 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: bitcoinj network (low level) statistics  (Read 1110 times)
jonas.schnelli
Member
**
Offline Offline

Activity: 66

bitcoin core contributor


View Profile WWW
September 23, 2013, 12:08:27 PM
 #1

Hi

I'd like to get some low level network statistics for all traffic done by bitcoinj.
Goal should be to count/cumulate total bytes in / bytes out as well as the current traffic bandwidth.

Is there already something implemented?
If not, where could i start implementing a such thing?

Thanks
---
1511048729
Hero Member
*
Offline Offline

Posts: 1511048729

View Profile Personal Message (Offline)

Ignore
1511048729
Reply with quote  #2

1511048729
Report to moderator
1511048729
Hero Member
*
Offline Offline

Posts: 1511048729

View Profile Personal Message (Offline)

Ignore
1511048729
Reply with quote  #2

1511048729
Report to moderator
A blockchain platform for effective freelancing
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1511048729
Hero Member
*
Offline Offline

Posts: 1511048729

View Profile Personal Message (Offline)

Ignore
1511048729
Reply with quote  #2

1511048729
Report to moderator
1511048729
Hero Member
*
Offline Offline

Posts: 1511048729

View Profile Personal Message (Offline)

Ignore
1511048729
Reply with quote  #2

1511048729
Report to moderator
1511048729
Hero Member
*
Offline Offline

Posts: 1511048729

View Profile Personal Message (Offline)

Ignore
1511048729
Reply with quote  #2

1511048729
Report to moderator
Mike Hearn
Moderator
Legendary
*
Offline Offline

Activity: 1526


View Profile
September 23, 2013, 02:22:42 PM
 #2

It's not implemented. Matt Corallo rewrote the networking layer, it's here:

https://code.google.com/r/bluemattme-bitcoinj/source/list?name=nonetty

His changes remove netty and replace it with a home grown framework. I'm slowly working through code review, but you could grab it and try it out to see how it looks. If it seems good then adding stats collection would be a nice improvement. Alternatively, adding hooks in the right place so stats collection can easily be plugged in would be even better.

In the current framework you can attach an onPreMessageReceived handler to get all inbound messages and calculate bytes used from that, but for outbound messages you'd need to modify the code itself.
jonas.schnelli
Member
**
Offline Offline

Activity: 66

bitcoin core contributor


View Profile WWW
September 24, 2013, 12:01:32 PM
 #3

Thanks.

Is there any plan when matt's changes (own framework) will be implemented?
(to decide where to implement)
Mike Hearn
Moderator
Legendary
*
Offline Offline

Activity: 1526


View Profile
September 24, 2013, 12:50:40 PM
 #4

You can see his changes here:

https://code.google.com/r/hearn-bitcoinj/source/detail?r=63309f5706f1918ef5b5ec29e35d4bc7fb9abeca&name=nonetty

I did a review this morning. It's looking pretty reasonable, but isn't quite mergeable yet. Hopefully soon, once we get some real world testing and address my comments. I'm going to keep it rebased at any rate. So I'd suggest building on top of that branch.

I think the best way to implement it post-nonetty is modifying PeerSocketHandler to record stats in the receiveBytes and sendMessage calls. Then you could make PeerGroup accumulate the statistics.

It looks like it isn't possible to do that in an easily pluggable way because PeerGroup always directly instantiates Peer. We could introduce a PeerFactory type glue point and then API users could customize the Peer objects that are in use, but bandwidth stats might be generally useful for everyone.

What is it you want to do with the data?
jonas.schnelli
Member
**
Offline Offline

Activity: 66

bitcoin core contributor


View Profile WWW
September 24, 2013, 01:18:18 PM
 #5

Sounds good. I first need to check the sources to get a plan about it.

I developing a tiny mac app with goals...
... very easy to use (dumb end user capable)
... low mem / cpu footprint
... take at less UI space as possible (status bar).

Simple screenshot of early dev status:


I would like to integrate a bandwidth statistics as well as a small network graph into the app. So user can prove what goes over the network. And this would also be a psychological sign for the user, that the wallet/bitcoin network is alive.
More and more user are also connected over 3G/4G over iPhone/Android tethering and might be concerned about bandwidth usage.

--
</jonas>
Mike Hearn
Moderator
Legendary
*
Offline Offline

Activity: 1526


View Profile
September 24, 2013, 03:36:04 PM
 #6

Android offers data usage monitoring at the OS level. Most clients just show number of connected peers. But sure, you could show such data if you wanted to.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!