AlCalzone / ioBroker.ble

Monitor Bluetooth Low Energy beacons
MIT License
41 stars 14 forks source link

High CPU-Load #36

Open cimba007 opened 5 years ago

cimba007 commented 5 years ago

Hello @AlCalzone . First I wanted to say very nice addon! I can see a lot of usecases. I now have been using it for some days and noticed a quite high CPU-Load. Is there anything that can be done about it?

image

Edit: I just noticed that ALL my CPU-Load comes from the ble-plugin

(when disabled)

image

Running hcitool lescan on the other hand is very resource friendly - so I guess the overhead is coming from iobroker

image

AlCalzone commented 5 years ago

Can you please show your adapter settings and tell me which version you are using?

cimba007 commented 5 years ago

image

Version 0.5.4 image

I am using an external Bleutooth USB-Adapter.

[    5.827353] Bluetooth: Core ver 2.22
[    5.827519] NET: Registered protocol family 31
[    5.827530] Bluetooth: HCI device and connection manager initialized
[    5.827574] Bluetooth: HCI socket layer initialized
[    5.827594] Bluetooth: L2CAP socket layer initialized
[    5.827658] Bluetooth: SCO socket layer initialized
[    5.885849] cdc_acm 1-1.3:1.0: ttyACM0: USB ACM device
[    5.887629] usbcore: registered new interface driver cdc_acm
[    5.887643] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    5.908015] usbcore: registered new interface driver btusb
[    7.324051] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    7.324064] Bluetooth: BNEP filters: protocol multicast
[    7.324100] Bluetooth: BNEP socket layer initialized
pi@ioBroker-RasPi:~ $ npm -v
6.4.1
pi@ioBroker-RasPi:~ $ node -v
v8.13.0
pi@ioBroker-RasPi:~ $ nodejs -v
v8.13.0

In general I am using the latest iobroker sd-card image on my Raspberry Pi 2 Model B.

@AlCalzone I appreciate your time to look into this issue ;-)

AlCalzone commented 5 years ago

Can you please try 0.5.5 (from the latest repo) to see if that fixes it?

cimba007 commented 5 years ago

I am not very familiar with this nodejs stuff. What do I need to do to install versioin 0.5.5 from the repo?

cimba007 commented 5 years ago

I am not sure if this can be compared as I purged all ble objects (went down from 7000!! to 700).

image

I managed to get to 0.5.5 be replacing the files and will monitor it for now.

AlCalzone commented 5 years ago

I am not very familiar with this nodejs stuff. What do I need to do to install versioin 0.5.5 from the repo?

Either

cd /opt/iobroker
npm i iobroker.ble

or by switching the repo in the settings in the admin UI.

AlCalzone commented 5 years ago

Almost 10% CPU still seems pretty high, but its definitely better. I'll keep this issue open so I can take another look.

cimba007 commented 5 years ago

Install from custom url (in Adapters) => from github => ble

This seems to get the latest version from github and installs it. Pretty convinient and easier then I thought.

Maybe this is caused by the many beacons that I receive .. (just a short snipped)

image

This is the reason a voted for a filter for known devices too. It the check for the mac address could be performed for each package and everything not in a "whitelist" will immediatly be dropped I can only guess that the cpu load would be lower.