Skip to content

Use spago for managing the server package set #148

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

Closed
wants to merge 1 commit into from

Conversation

hdgarrood
Copy link
Collaborator

This gives us an easy way of depending on the entire package set at
once, so that any package in the set can be used in Try PS.

This gives us an easy way of depending on the entire package set at
once, so that any package in the set can be used in Try PS.
Copy link
Member

@thomashoneyman thomashoneyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s great news that the entire set is available! Just to check: what would actually be compiled on Try PureScript when a user makes changes to their code?

@hdgarrood
Copy link
Collaborator Author

The whole package set would be compiled first, before the server starts listening for requests, so only one module would ever be compiled per request. On my laptop it takes around 34s to compile the whole set (or 5m of CPU time).

@natefaubion
Copy link
Contributor

Do we want the whole set available? Do we know what modules require FFI shims?

@hdgarrood
Copy link
Collaborator Author

I think having the whole set available makes sense; I'm sure a lot of libraries will require shims, but in the case of libraries which need shims which aren't there, the UX isn't really any worse, you just get a slightly different error. It's not as if users have any good way of knowing what modules they can expect to be available on Try PS at the moment.

@natefaubion
Copy link
Contributor

Is there any memory concern for the server compiling against the whole set?

@hdgarrood
Copy link
Collaborator Author

Oh right, yes, that's a good point. Compiling the whole set to start with is fine -- the CI for the package-sets repo manages that -- but I think the problem arises because tryps keeps all of the externs files in memory, and it also keeps a prebuilt JS bundle of the entire package set in memory (which is exposed via the /bundle route). On my laptop, running tryps with the whole package set consumes about 3.3GB of memory; removing the /bundle route brings that down to about 2.1GB. I think running tryps on a server with sufficient memory to handle this is doable if we raise a little more via opencollective, but the fact that the package set will probably get larger over time additionally complicates things. I think if we want to provide the whole package set it may be worth loading externs files from disk, or working out some kind of caching mechanism so that, say, up to 500MB of the most frequently used externs files get to stay in memory, or something like that.

@hdgarrood hdgarrood closed this Apr 12, 2020
@natefaubion
Copy link
Contributor

The bundle.js should be unnecessary now. I think optimizations to extern size and sharing should help, but I agree that some sort of smarter strategy is necessary.

@hdgarrood
Copy link
Collaborator Author

I am halfway through preparing a PR which removes bundle.js 😄

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

Successfully merging this pull request may close these issues.

3 participants