Giter Site home page Giter Site logo

Comments (12)

bsergean avatar bsergean commented on May 14, 2024

So it looks like your client only 'sends' data to the server right ? Is your server reply back with the same data ? If that's the case stop doing that as it will take time to 'download and process that data on the client'.

Also are you compiling the library in Release mode ? Here is what you should do to do that if you are using the top level makefile.

diff --git a/makefile b/makefile
index 30b3a29..01a3ba5 100644
--- a/makefile
+++ b/makefile
@@ -9,10 +9,10 @@ install: brew
 # on osx it is good practice to make /usr/local user writable
 # sudo chown -R `whoami`/staff /usr/local
 brew:
-       mkdir -p build && (cd build ; cmake -DUSE_TLS=1 -DUSE_WS=1 .. ; make -j install)
+       mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Release -DUSE_TLS=1 -DUSE_WS=1 .. ; make -j install)
 
 ws:
-       mkdir -p build && (cd build ; cmake -DUSE_TLS=1 -DUSE_WS=1 -DUSE_MBED_TLS=1 -DUSE_VENDORED_THIRD_PARTY=1 .. ; make -j)
+       mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Release -DUSE_TLS=1 -DUSE_WS=1 -DUSE_MBED_TLS=1 -DUSE_VENDORED_THIRD_PARTY=1 .. ; make -j)
 
 uninstall:
        xargs rm -fv < build/install_manifest.txt

from ixwebsocket.

EhsanVahab avatar EhsanVahab commented on May 14, 2024

My server doesn't reply any message to the client in this part of app.
No I haven't compiled IXW in Release mode. I've just used:

make

sudo make install
`
```

from ixwebsocket.

bsergean avatar bsergean commented on May 14, 2024

from ixwebsocket.

EhsanVahab avatar EhsanVahab commented on May 14, 2024

The BW is not the problem.
I will build IXW in ReleaseMode then enable per message comperession. Good advices
I let you know the result.
Thans for your help.
You always come to my aid

from ixwebsocket.

bsergean avatar bsergean commented on May 14, 2024

from ixwebsocket.

EhsanVahab avatar EhsanVahab commented on May 14, 2024

Dear @bsergean ,
I've compiled IXW in ReleaseMode and tested with disabling and enabling perMessageDeflate.
sadly non of them has been highly effective.
the another parameter that crosses my mind is fragmentation size.
One the server side, I get the data fragmented into 42 to 45 parts(the length of each one is exactly 8192 except the last part).
So I took a look at the IXWebsocketTransport.cpp line:796 and realized that seemingly the large data is broken into some parts.
Is there any parameter to increase the len of each fragmented part or decrease the number of part?
I guess by decreasing the step size, we will have lower processing cost

from ixwebsocket.

EhsanVahab avatar EhsanVahab commented on May 14, 2024

I got new thing that I think it's very important.
when there is no packet to be sent, the cpu is still busy and around 20% of it's performance is taken.
I think the IXW tries to have a negotiation with the server to keep its connection alive.

from ixwebsocket.

bsergean avatar bsergean commented on May 14, 2024

from ixwebsocket.

EhsanVahab avatar EhsanVahab commented on May 14, 2024

Dear @bsergean ,
seemingly my last message hasn't been sent on the github.
doesn't matter. I find the problem.
there is an endless loop in IXWebsocket.cpp line: 291 to 351
I don't know why and don't have enough OS information about that, but I'm pretty sure, based my experiences , Raspbian is too sensitive to endless loop. it takes high processing cost even there is no command inside.
I put sleep(5) inside the loop and it's solved. I know if I have a message from the server, it's triggered every 5 seconds but my server's message is not so critical.

from ixwebsocket.

bsergean avatar bsergean commented on May 14, 2024

I tried running ws connect on macOS, and watched CPU usage which was at 0%.

If you have a standalone program that I can run and that display the problem please attach it to this issue and I can try to troubleshoot this further. There shouldn't be any need for that sleep in that wait loop. There should be no sleep call in that wait loop, the loop block waiting for input when it call poll.

I'm happy if you found a workaround, but I don't think that the whole mystery is solved.

from ixwebsocket.

EhsanVahab avatar EhsanVahab commented on May 14, 2024

I tested on the Ubuntu too and the CPU usage was around 1%
As I mentioned I don't why the Raspbian gets stuck into trouble when there's an endless loop,even an empty loop. it's a little bit strange to me.
I'm working on it. I'll send you a standalone instance of the app to be watched

from ixwebsocket.

bsergean avatar bsergean commented on May 14, 2024

from ixwebsocket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.