Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration Option for Permanent Chunk Loading to Reduce I/O Pressure in Train Carts #496

Open
fjybiocs opened this issue Mar 9, 2024 · 4 comments

Comments

@fjybiocs
Copy link

fjybiocs commented Mar 9, 2024

Feature Request

Configuration Option for Permanent Chunk Loading to Reduce I/O Pressure in Train Carts

Description

Hello, I've noticed that Train Carts has a very high time consumption on the CraftWorld.getChunkAt() event (24%), which may cause server lag. I suspect that CraftWorld.getChunkAt() might involve I/O operations, leading to high latency.

On my server, there is a long railway line, and the trains running on this line are set to force load chunks, and trains are automatically generated at regular intervals. I wonder if the frequent loading and unloading of chunks leads to intensive I/O operations, causing lag.

Therefore, I would like to know if Train Carts offers such a configuration: setting the chunks that trains frequently pass through to stay in memory permanently to reduce I/O pressure. Because I have sufficient memory space to do this.

If there is no such configuration option, I wonder if it could be considered to add such an option. This could significantly improve the performance of servers using the Train Carts railway system as their main gameplay, by keeping the chunks along the railway line in memory permanently, reducing the number of I/O operations.

Examples

For example, set a maximum number of permanent chunks and use the LFU (Least Frequently Used) algorithm to evict permanent chunks.

@RyanHecht
Copy link
Contributor

My gut tells me that this is out of scope for TrainCarts, and should likely be its own plugin. BKCommonLib's ChunkUtil has some forceChunkLoaded convenience methods that folks looking to implement this for themselves may want to use

@RyanHecht
Copy link
Contributor

I guess you could make the argument that rails could have a keepChunksLoaded property similar to carts? I could see that being added to TC-Coasters but not sure if there's infrastructure to easily do that for vanilla rails in TC proper

@bergerkiller
Copy link
Member

I have considered making a very simple plugin that simply uses bkcl's ForcedChunk API to keep parts of the world loaded. Chunk loaders are some of the easiest things to make.

A problem is though, a server only has so much memory, and when people plop down a chunk loader with radius a billion it kills the server.

@bergerkiller
Copy link
Member

Probably if it works like in modded where a particular block automatically keeps stuff loaded, and this works with worldedit and such, then people can incorporate it into their builds (under the track for example)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants