Go Down

Topic: Rest API gets slower and slower and finally webserver hangs... (Read 12884 times) previous topic - next topic

mamu

OttoF, have you tried your scenario of communication with the Arduino sketch without using Bridge?
Is this unstable too?

BTW: I moved to direct Serial1 communication without using Bridge and this dropped memory consumption for my sketch from 22 KB to 11 KB, leaving much more bytes left for doing Arduino sketch kind of work.

OttoF

How does communication between arduino sketch and php work?
I will test it.
But that doesn't solve the problem with bridge, I would prefer to have a solution for the bridge.
It is a part of arduino and all user have this problem.
I do some tests with my projekt and it seems to be a problem on the bridge lib on arduinos side.
A simple test with an digital input what direkt sets an digital output works slower and slower
(a led on the pin needs secondes to be on  or off )
and at the same time a simple bridge.put of this digital out works not longer,
the php webside works ok, but the bridge.get for the d.out have no value.

NewLine

What makes you think it is an issue with the Bridge as such? In all the examples mentioned before some webserver seems to be involved. I have an application where I would need to use the bridge a lot to communicate between Linino python and the sketch. Would this also experience this slowdown?

I will maybe make a test setup to use the bridge to send messages every second and see what happens...

Roque Campos

#18
Nov 23, 2013, 07:39 pm Last Edit: Nov 23, 2013, 07:41 pm by Roque Campos Reason: 1
Hi,

I had a similar problem. I have a sqlite database on the linino side, and the sketch is accesing every 30 seconds the database to write temperature values, doing curl calls and to php wichs acts as webservice.

Then I have an android app wichs querys the sqlite database using the same php script. I was curious about the linino web server capacity, and I deployed the android app to more devices and decreased the delay from the sketch execution from 30 seconds to 3 (just for a stress test).

With two clients (the sketch and the android app), all worked well. With three clients all worked well most of the time, because the clients are doing querys randomly and don't collide often.

But when two or more request from the clients to the php script collide, then all stops. I have to manually restart the uhhtpd to get it working again.

The solution was to increase the maximum number of concurrent requests in the web server configuration file. In my case, it is enough with 4... Maybe this helps

Bye

mamu

I would like to share my observations on that topic:
I moved from using Bridge to do a direct Serial1 communication between Arduino and Lininio. That works very well except that my Arduino sketch received the request with a delay of 2-3 s (!). I did measurements to be sure it is not because of the tornado WebSockets I use.
I changed my Arduino sketch from using "serialEvent1()" to using the main loop. And voila! Communication delays only for approximately 50ms. Looks like the only stable and fat way is the one shown in YunSerialTerminal.
As far as I know, Bridge uses Serial1. And maybe it also uses serialEvent1 to get notified for incoming data?

NewLine

Tonight I tried to continuously send random data (although for now with a fixed key and length), and expect the other side to return the same data. I measure the time until that succeeds. I let it run for about 8 hours and did about 30000 put/gets without the bridge as such getting slower. So I do not think it is caused by the bridge as such.

OttoF

--------------------------------
From Roque
But when two or more request from the clients to the php script collide, then all stops. I have to manually restart the uhhtpd to get it working again.

The solution was to increase the maximum number of concurrent requests in the web server configuration file. In my case, it is enough with 4... Maybe this helps
---------------------------------

based on your results I was thinking about my attempts.
I had actually always more than two sometimes four clientwindows open
and the automatik php script what runs every minute by cronjob my collide with them too.
Seems this is also my problem
I will test how many clients easily run on my projekt.

federicofissore

I'm still struggling to reproduce this weird issue. I was unable to run olivb sketch and simon one is calling an api, instead than serving one
OttoF or anyone, can you give me a complete project (with every needed ino or py), so that I can stress test it?

OttoF

Hello Federico

i do some test and give you my project tomorrow.

at the moment the webside on linino seems to be stable
but the arduino side sketch hangs.
that makes me crazy :-(

woniol

Hello,
I'm doing very intensive tests with standard Brigde example. I'll post my results :)
So far I works fine for about 8 hours.

OttoF

#25
Nov 28, 2013, 11:53 am Last Edit: Nov 28, 2013, 01:29 pm by OttoF Reason: 1
Hello @ all

i am still work on this, at the moment it runs for nearly 12 hours
after this sometimes the arduino side and one time the linino side hangs.
soon i will give you my projekt

OttoF

installed new ide,
my project now runs, its great i can go forward.


simon_schvartzman

Guys I've installed the new IDE but in my case the Yun keeps hanging after a while...

Any hints?

I'm extremely frustrated with the Yun's behaviour.



OttoF

#29
Dec 10, 2013, 03:43 pm Last Edit: Dec 10, 2013, 03:53 pm by OttoF Reason: 1
Can you give us more details

my project works well at the moment.
works with
php5, sqllight,
some php webpages on linio witch read an write to sql and 32U4
cronjob every minute what read sql datas and transfer them to 32U4 in 7 parts with 10 bytes

only wlan hangs yesterday one time but every thing else works.

Go Up