Page 1 of 2

Noticing slow return communication from webapp

PostPosted: Tue Jul 28, 2015 4:07 pm
by wilsonb
Not sure if this changed after updating DEV code from Github running new Firmware Version 2.2a.8
It's pretty much a valina image with nothing additional running.
cd /opt/alarmdecoder-webapp

But it seems the webapp is response running slow. For example when I start it up, it takes a while to register READY(LED) says Please Wait , when clicking on Settings, it takes 16 sec. before it changes page. (In Netscape it says Connecting... )
From there, clicking on Notifications takes 13sec.

Is there a way to speed up the performance from my end?



I assume this is just interface GUI performance and has nothing to do with alarm responses.

Im definitely not complaining. I just wanted to compare with others and make sure it wasn't just me.

Re: Noticing slow return communication from webapp

PostPosted: Tue Jul 28, 2015 4:14 pm
by kevin
What kind of pi are you using? Is it one of the new pi 2's or an older model?

Re: Noticing slow return communication from webapp

PostPosted: Tue Jul 28, 2015 4:19 pm
by wilsonb
It's a B+ overclocked to 900mhz

Re: Noticing slow return communication from webapp

PostPosted: Tue Jul 28, 2015 4:21 pm
by kevin
While an older single core pi will work, when you start adding things like notifications etc, the CPU becomes easily overloaded and slow. We recommend going with a quad core pi 2. And that's what we sell with our bundles.

Re: Noticing slow return communication from webapp

PostPosted: Tue Jul 28, 2015 6:25 pm
by wilsonb
Thanks for the feedback, just for the record and others with a B+ model...

At my "Hacker" meetup tonight, I demonstrated your great product and connected it directly eth0 to my laptop.
Ran the webapp, and it runs fine. Must be my network at home using router.

I have a Raspberry Pi 2 , but use that for many other things and B+ is extra laying around.. glad it suffices..

Re: Noticing slow return communication from webapp

PostPosted: Tue Jul 28, 2015 6:37 pm
by kevin
Very well could be a network problem - a B+ should suffice, but I have seen them get bogged down by adding camera streams and such (which it is capable of), and a lot of notifications... but if it worked fine locally, then I would have to assert it is a networking issue of some sort :)

Thanks for the demonstration, hope it went smoothly!

Re: Noticing slow return communication from webapp

PostPosted: Thu Jul 30, 2015 2:22 pm
by wilsonb
As for performance goes, it seems top is showing Python using 97.9% CPU. I have been reading that Python is not running very inefficent on the pi and could be improved.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2675 pi 20 0 99.2m 66m 15m R 97.9 15.4 40:48.25 python
Maybe in future releases they will improve it.


Doesn't the ad2pi use the I2C bus?

Speeding up the I2C bus on Raspberry Pi and Arduino
So by default the I2C bus is running at 100kHz. Not bad, but no blazing speed demon either.

Most I2C devices can readily run at 400khz, if you keep the lines short.

On the Raspberry Pi, the bcm2708 chip manages I2C (smbus)
From the Driver for Broadcom BCM2708 BSC Controllers

#define I2C_TIMEOUT_MS 150

#define DRV_NAME "bcm2708_i2c"

static unsigned int baudrate = CONFIG_I2C_BCM2708_BAUDRATE;

module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);

MODULE_PARM_DESC(baudrate, "The I2C baudrate");

To increase the speed on the Raspberry Pi, you can pass an optional baudrate parameter via modprobe to the I2C module


sudo modprobe -r i2c_bcm2708 && sudo modprobe i2c_bcm2708 baudrate=400000
To make that change permanent, you have to create a new i2c.conf file:
1
2
3
4
5

sudo nano /etc/modprobe.d/i2c.conf

type options i2c_bcm2708 baudrate=400000
ctrl-x to save (answer yes)
This will force your Raspberry Pi to initiate communications at 400k baud.

http://arduino-pi.blogspot.com/2014/03/ ... i-and.html

Re: Noticing slow return communication from webapp

PostPosted: Fri Jul 31, 2015 9:55 am
by kevin
The AD2PI does not use I2C bus. Please do not do this. It is not an issue with the speed of serial communications. Suggest using a pi2 for our product if using our web application. Plain and simple.

Re: Noticing slow return communication from webapp

PostPosted: Fri Aug 07, 2015 8:55 am
by wilsonb
Alright, so I went out and got a Raspberry Pi 2, instead of B+
Vanilla build.

Still have delay in Webpage response from any browser. When arming/disarming for example, it takes a few seconds to register (9+ sec avg)
Webpage takes that long to update Ready light also. :?

My ping to Pi is good, avg 15ms

It seems Python is not very efficient.
Top shows it using 97% CPU

Re: Noticing slow return communication from webapp

PostPosted: Fri Aug 07, 2015 9:14 am
by kevin
Does this problem go away when you have no notifications defined?