getkaiwa / kaiwa

[UNMAINTAINED] A modern XMPP Web client
http://getkaiwa.com
MIT License
1.33k stars 154 forks source link

Kaiwa very slow to load, eating up CPU #81

Open the-solipsist opened 8 years ago

the-solipsist commented 8 years ago

Hi, I'm running Kaiwa for my organization's MUC (pre-existing Prosody server), and it's incredibly slow, often failing to load.

I did an strace -p [PID] and that gives me this over and over againg:

futex(0x15ed7a0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x15ed764, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x15ed760, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
futex(0x15ed7a0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x15ed764, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x15ed760, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
futex(0x15ed7a0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x15ed764, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x15ed760, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
futex(0x15ed7a0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x15ed764, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x15ed760, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
futex(0x15ed7a0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x15ed764, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x15ed760, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
futex(0x15ed7a0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x15ed764, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x15ed760, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
futex(0x15ed7a0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x15ed764, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x15ed760, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
futex(0x15ed7a0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x15ed764, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x15ed760, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
futex(0x15ed7a0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x15ed764, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x15ed760, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
futex(0x15ed7a0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x15ed764, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x15ed760, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
futex(0x15ed7a0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x15ed764, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x15ed760, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
futex(0x15ed7a0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x15ed764, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x15ed760, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
futex(0x15ed7a0, FUTEX_WAKE_PRIVATE, 1) = 1
clock_gettime(CLOCK_MONOTONIC, {1406831, 748421653}) = 0
clock_gettime(CLOCK_MONOTONIC, {1406831, 793372478}) = 0
clock_gettime(CLOCK_MONOTONIC, {1406831, 794328592}) = 0
clock_gettime(CLOCK_MONOTONIC, {1406831, 968383448}) = 0
clock_gettime(CLOCK_MONOTONIC, {1406831, 969335648}) = 0
clock_gettime(CLOCK_MONOTONIC, {1406832, 4594650}) = 0

A fulller log: http://ix.io/ob9

Any ideas on how to debug the problem?

nogweii commented 8 years ago

I'm experiencing this, too. The page takes a very long time to do it's initial load, though once that is done navigating between pages and chatting is all very quick. Looking at my server, I can see the node process spikes in CPU usage, pegging the CPU.

This is via the "Deploy to DigitalOcean" script.

nogweii commented 8 years ago

Oh, looking at the network graph in my browser, I notice that the piece that takes the longest to download is app.nonCached.js, taking upwards of 8 seconds on the request. More than likely, there is a configuration setting that needs to be turned on so that the file is generated only once and served to every user.

ghost commented 8 years ago

Hello, just tested and got the same slowness and node is taking 100% of cpu.

balert commented 8 years ago

seems like I've got the same thing. Curiously it suddenly started to happen.