Having DB Connection Spike Issues Trying to Run Parse Live Query Server

44 views
Skip to first unread message

za...@zackshapiro.com

unread,
Oct 28, 2018, 3:39:14 PM10/28/18
to Back4App
Hi everyone,

I have an app that has 250K monthly active users, and we're adding Parse Live Query (LQ) to our app. The biggest issue we have is that when clients connect to the LQ server, DB connections in mlab spike significantly (like 2k -> 6.5k, and that's with only ~250 people upgraded to the latest version).

From testing a lot of things, I've come to learn that the connections are created and then never disconnect. 

In my client, when the view controller dismisses, I specifically called client.disconnect() (where client is an instance of ParseLiveQuery.Client, it's a Swift app).

This is the contents of my separate Parse LQ app:

var express = require('express');
var cors = require('cors')
var ParseServer = require('parse-server').ParseServer;


var app = express();
app
.use(cors());
// We include the lines below so that we can hit `/` and it passes the Elastic Beanstalk Health Check
app
.get('/', function(req, res) {
  res
.status(200).send('Make sure to star the parse-server repo on GitHub!');
});


var port = process.env.PORT || 1338;
var httpServer = require('http').createServer(app);
httpServer
.listen(port, function() {
    console
.log('BUMP Live Query Server running on port ' + port + '.');
});


ParseServer.createLiveQueryServer(httpServer, {
    appId
: process.env.APP_ID,
    masterKey
: process.env.MASTER_KEY,
    serverURL
: process.env.SERVER_URL || 'https://socket.myApp',
    javascriptKey
: process.env.JAVASCRIPT_KEY,
    redisURL
: process.env.REDIS_URL || "redis://:<password>@redis-1234.c-9.us-east-1-1.ec2.cloud.redislabs.com:17247",
    websocketTimeout
: 10 * 1000,
    cacheTimeout
: 60 * 600 * 1000,
    verbose
: process.env.VERBOSE_KEY || false,
});


My main app and my Parse LQ app share the same `APP_ID` , `MASTER_KEY` and `JAVASCRIPT_KEY`, they connect through the same `REDIS_URL`. 

My node version is 8.11.3, my parse-server version is 2.8.4 (with the mongo driver above 2.2.4).

I'm unclear how to run my app without connections spiking and taking the whole thing offline, while also using Parse LQ Server.

Any help would be greatly appreciated.

Thanks!

nat...@back4app.com

unread,
Dec 6, 2018, 8:52:06 AM12/6/18
to Back4App
Hi,

thanks for reaching out! In case, our team has been worked to optimize the Back4App hosting for this problem you are facing does not happen on our platform. At the moment, I'd like to offer you a meeting with our team of engineers to test your application running at Back4App. Let us know your opinion so we can schedule a meeting :)

Regards,
Natália.
Reply all
Reply to author
Forward
0 new messages