Geek Guy
Geek Guy

Reputation: 702

Exceeded soft memory limit of 1024 MB after servicing 0 requests total

Before anyone mark this question as duplicate, there are a few issues that makes it different to me.

  1. It is shocking to to see this error report indicating Zero requests!! with 1024 MBs (1GB!!) yet I made a post request with text payload that cannot even reach 1KB.

Error:Exceeded soft memory limit of 1024 MB with 1059 MB after servicing 0 requests total. Consider setting a larger instance class in app.yaml

Note: nothing else is using this server!! No cron jobs, no deamons, nothing I expect to consume memory. Before, I have done a lot of code optimizations for this server and it has actually been idle. Only serving button click requests from my phone without background service in the app(One app by one user).

YAML file: I use;

# [START gae_quickstart_yaml]
runtime: nodejs8
instance_class: F4_1G
# [END gae_quickstart_yaml]
automatic_scaling:
  max_instances: 11
  target_cpu_utilization: 0.9

Question:

  1. What is is the problem?

  2. If I take this to production (given the issue is solved), can it handle 5000-10000 users making 20-30 requests per day? if not, I would really appreciate a sample configuration for this number of users. It is my first time to host on Google app engine/Google cloud

EDIT: Endpoint code:

router.post('/endP', (req, res) => {
    let options = req.body.userdata;
    let isResponded = false;
    //simply inserting to DB with knex
    db_helper.insert(con.knex, options).then(async (s) => {
        isResponded=true;
        let reply = JSON.stringify(s);
        const message_content = {
                data: {
                body:reply
                },
                android: {
                    ttl: 3600 * 1000 * 24 * 28, // 4 weeks
                    priority: 'high',
          
                },
                topic:"myTopic"
            };
            //FCM notification
            await firebase.sendMessage(message_content);
            res.status(200).send(encryptor.encrypt(reply)).end();
    }).catch(err => {
        if (!isResponded) {
            let errr = err;
            res.status(500).send('Failed').end();
        }
        return null
    });
});

Upvotes: 1

Views: 1680

Answers (1)

Elad Amit
Elad Amit

Reputation: 605

How much memory does it consume when run locally? In case you can't post all of your code, please post the result of a memory profile when it is running I know stackdriver have a profiler in beta which could be useful to track down what is happening https://cloud.google.com/profiler/

Upvotes: 2

Related Questions