How does glitch throttle CPU?


#1

Does it slow the server down after the server uses too many resources at once? Do we get a bucket of cpu resources every launch?

I’d really like to know so I can better optimize my web app.


#2

Hi @CrazyPython! There are currently no project-specific CPU throttling limits in place. Each project runs in its own container and has access to the full CPU resources of its container. If you’re comfortable in the console you can run top in the project’s console to get a little more detail on where your project’s container is spending its CPU time.

All the technical limitations that are in place can be viewed at https://glitch.com/help/restrictions/.

Are you having some specific problem we can take a look at?


#3

What container is used, and what are the cpu throttling on the container?

I know where my application is spending its cpu time, and the application does not get stuck in an infinite loop nor does it have a memory leak. However, I have noticed that the application shows a measurable slowdown 10-20 seconds after it starts, and the measurable slowdown does not occur when I run the project on my own computer. The measurable slowdown is sudden and does not correlate with any application event

I suspect this is because the container is throttled. Does glitch run on t2.micro instances? If not, how are the virtual machines configured?


#4

Glitch apps run in Docker containers with a single CPU and a relatively low CPU shares; the exact values probably aren’t that important and are subject to change. Based on this your project wouldn’t specifically be throttled unless the host was itself encountering resource contention; otherwise your project should have access to as much CPU as it needs. It also seems unlikely that this sort of throttling would be as predictable as you’ve indicated.

If you can share your project url we can take a look to see if something odd is going on; if you’d rather keep it private you can email that information to support@glitch.com instead of posting it here.


#5

This is my project URL. https://fantasy-conga.glitch.me/ The server runs Arras, a community-developed multiplayer game.

However, the Arras community has consistently found that Glitch servers cannot run a full multiplayer game arena without the game becoming very laggy. Instead, Glitch is only capable of demoing code or acting as a testbed server. The linked URL has an arena the size of a real game server.

When the same code is run on a regular home laptop, the server runs without any lag at all.

You can see Arras running on single-core OpenStack and Linode servers at http://arras.cx. These servers also do not have the same capability as a single-core home laptop, but they aren’t very transparent about their throttling policies. We’d like glitch to be more transparent.


#6

Thanks for the additional detail.

I’d like to take a closer look. Assuming your project is private, do I have your permission to look at the code and perhaps make a remix I can fiddle with?

On a more “meta” level, I’d like to know more about what you plan to do with any additional detail we choose to provide, if any. Are you expecting to update the Arras codebase to address or work around any throttling concerns? Will you simply use it to determine if Glitch is an appropriate venue for Arras servers? Regardless of what additional information we’re willing and able to provide, it’s not a given that we’d be able to alter our architecture in the near term to address this to your satisfaction.