Skip to content

Next steps for improving GC performance and configurability #6652

@dktapps

Description

@dktapps

Problem description

Since the implementation of #6554, several server owners have been discovering that GC is the source of many of their mysterious performance woes.

This PR didn't worsen performance, but it did make the problem appear in an obvious place in timings reports, rather than in random code pathways.

I was aware when I made the PR that the parameters were probably not optimal for PM's use case, but my focus was on ensuring that the behaviour properly mirrored the PHP standard behaviour so that I didn't accidentally hurt performance. It appears I succeeded in that goal, and now it's time to do something about these issues.

Proposed solution

Several steps come to mind:

  • Allow turning off the cycle GC entirely. PM by itself doesn't really need it (since it destroys all known cycles explicitly when objects are done with), and if plugin devs on servers are conscious of cycles, they may not need this expensive GC at all.
  • Allow configuring GC parameters like the GC threshold step, GC starting buffer size, GC threshold increase trigger, etc.
  • Allow setting a minimum time between GC runs. Larger servers have found that the GC runs far too frequently and wastes lots of CPU time trying to collect long-lived objects like Server and Player.
  • Look at integrating something like ext-gcignore so we can stop the GC wasting time on expensive objects. This will significantly reduce the GC burden.

Alternative solutions or workarounds

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Category: CoreRelated to internal functionalityPerformanceType: EnhancementContributes features or other improvements to PocketMine-MP

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions