0

I have a website deployed on Google Computer Engine with apache2. Everything is fine, until I send notifications from onesignal. When I have over 1k notifications requests per minute, the firewall (I think) blocks incoming connections for port 80 and 443 for few minutes, after that everything is ok. Does GCE think is flood?

Any ideas? Thanks in advance.

cokeman19
  • 2,405
  • 1
  • 25
  • 40
Dragos
  • 1
  • 2
  • It seems like the high amount of requests over-utilized your GCE VM instance. Have you [checked](https://stackoverflow.com/questions/43991246/google-cloud-platform-how-to-monitor-memory-usage-of-vm-instances) the memory usage of VM instances while you make this requests? – Digil Apr 28 '18 at 00:24

1 Answers1

0

Web push requires background workers known as service workers to display notifications when your site isn't open. These background workers are regular JavaScript files that run in a special browser environment. The code in your site's OneSignalSDKWorker.js is the service worker.

Each subscriber's browser downloads the script from OneSignalSDKWorker.js to store a local copy for running, and checks for updates to the worker script by downloading OneSignalSDKWorker.js again periodically.

When:

  • The user visits your site
  • Or, the user receives a push notification

OneSignalSDKWorker.js will be downloaded from your site to check for updates, although this check only runs a maximum of once every 24 hours, to prevent too many requests to your site.

The periodic checks are required, and are performed by the browser, not by our SDK. The amount of time between checks cannot be greater than 24 hours.

With each subscriber's browser periodically checking for updates this way, it can lead to an increased traffic load.

Some ways to reduce your server's load are:

  • Host resources elsewhere if possible

A common optimization is to serve your notification icon from an image host like Imgur instead of your site.

  • Using timezone-based notifications

  • Using a reverse proxy such as CloudFlare

If your site's content is more static than dynamic, you can use CloudFlare to serve cached versions of your page and not just your assets, which can virtually eliminate requests to your server.

  • Segmenting notification delivery

If none of these options are available, you may have to increase your server's performance to be able to handle the traffic requests.

JonF
  • 554
  • 2
  • 6