HaxeFoundation / haxe

Haxe - The Cross-Platform Toolkit
https://haxe.org
6.19k stars 655 forks source link

Server maintenance #8734

Open Simn opened 5 years ago

Simn commented 5 years ago

Once we've merged https://github.com/HaxeFoundation/haxe/pull/8730 we'll be able to poll the connected socket to see if there's a pending request. This should allow us to implement a pattern like so:

let rec loop block =
    match read_from_socket block with
    | Some data ->
        process_data data
    | None ->
        if there_is_more_maintenance_to_do() then begin
            do_some_small_maintenance();
            loop false
        end else
            loop true
in
loop false

This assumes that the socket read function returns Some data if there's data, and None otherwise.

It is important to keep maintenance tasks small so an incoming request isn't delayed too much. Such tasks could include:

Generally, the goal is to keep memory usage at an acceptable level while not disrupting operations.

This requires some design to abstract the maintenance tasks.

Simn commented 5 years ago

Something else we can do during this downtime: Run cl_restore on our cached classes.

Simn commented 5 years ago

Another thing: Register a task for each directory when exploring class paths. This would improve startup time at the risk of missing out on some types when requesting a really quick toplevel completion.

Simn commented 9 months ago

This is mostly done, or partially obsolete with the changed caching.

kLabz commented 9 months ago

There's still

Check if we have compilation contexts which haven't been accessed in a long time and discard them.

Which could now be saved to disk instead of being discarded. Should we open a separate issue for this, or is it not worth adding anyway?

Simn commented 9 months ago

Hmm yes, that one might be a good idea still. I'll reopen.