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

Ideas for Performance Improvements #1

Open
zhemao opened this issue Jan 5, 2014 · 11 comments
Open

Ideas for Performance Improvements #1

zhemao opened this issue Jan 5, 2014 · 11 comments

Comments

@zhemao
Copy link

zhemao commented Jan 5, 2014

Hi, I came across this project recently and was quite intrigued. I looked through the code and it seems that currently, a docker container is created every time the user executes code. This is also done completely synchronously, blocking the entire thread.

It would probably be more scalable to spin up a fixed number of containers for each repository and run a network server on the container that will take requests, execute the command, and respond with the standard output. The downside is that this would require enabling the network in the container, but you could probably set up firewall rules in the container that block outbound connections.

I'm going to take a look at implementing this, but I'm currently having some difficulties getting the code to work on my computer.

@namin
Copy link
Owner

namin commented Jan 5, 2014

Thanks for your interest and suggestion. I am glad you're looking at performance :-)

Would you please elaborate on the difficulties getting the code to work on your machine?

@zhemao
Copy link
Author

zhemao commented Jan 5, 2014

I think it's mainly due to incompatibilities with my version of docker. For one thing, the Python API is complaining that "network_disabled=True" is not a valid argument to create_container. I've taken that part out for now in order to get things working. Which versions of docker and docker-py are you using? Mine are 0.7.3 and 0.2.3 respectively.

Right now, I'm able to load the site OK, but I'm getting errors when running the Scheme code

error: (255)
*** Vicare: unhandled exception:
 Condition components:
   1. &lexical
   2. &i/o-read
   3. &message: "invalid syntax"
   4. &irritants: (#\{)
   5. &source-position:
       port-id: "/home/runner/files/pre.txt"
       byte: 816
       character: 816
       line: 12
       column: 9

I tried printing out what "pre_input", "main_input", and "post_input" are supposed to be, and pre_input seems to be blank, so I'm puzzled at why this error is occurring.

@namin
Copy link
Owner

namin commented Jan 5, 2014

Regarding docker versions, I am running 0.7.3 as well. For docker-py, I am using my own fork of master, which has the network_disabled option. I've sent a pull request for it, see docker/docker-py#133

The error with vicare is puzzling. Can you first try going to your host at the url /repl/webyrd/webmk?refresh=1 and try out the repl? Two other suggestions: (1) print the "url_pre" and visit that page, and see if you get something blank as you're supposed to; (2) since I am not deleting the images, and containers, perhaps you can also find out what the pre.txt files look like in the container/image.

Thanks!

@zhemao
Copy link
Author

zhemao commented Jan 5, 2014

I figured out the problem. I didn't have SERVER_NAME set, so the url wasn't being formed correctly. I've fixed it so that the correct URL is being passed in, but c.insert is timing out for some reason.

@namin
Copy link
Owner

namin commented Jan 6, 2014

Oh, I see. What are you using for the SERVER_NAME, localhost:5000 or a "real" hostname? I've only tried it with real host names, even when developing, but I ought to make sure it works also locally.

Thanks!

@zhemao
Copy link
Author

zhemao commented Jan 6, 2014

I am using "localhost:5000" as my SERVER_NAME.

@namin
Copy link
Owner

namin commented Jan 6, 2014

Thanks for the confirmation. I'll make sure I can run it with localhost, and ping you again. Thanks for your patience :)

@namin
Copy link
Owner

namin commented Jan 7, 2014

I added the dev server-side installation steps here: https://github.com/namin/io.livecode.ch/blob/master/README.md#development-server-side-installation-steps

BTW, the timeout was because by default flask uses a single thread for development.

Thanks again! Let me know how things go :)

@zhemao
Copy link
Author

zhemao commented Jan 10, 2014

So I've realized that I don't really have the bandwidth to work on this right now. However, I've made a few commits on the runner branch of my fork to introduce a Go program that can take messages from a TCP socket and pipe them into the standard input of a command. It's pretty hacky and you probably want to clean it up before using it, but it gives an idea of how the process inside the container could be implemented. Also, I wrote it in Go mainly because you can just copy the executable into the container and run it without having to install an extra runtime.

@namin
Copy link
Owner

namin commented Jan 10, 2014

Sure, no problem. I appreciate your input already. I'll take a look at what you did. Thanks very much!

@namin
Copy link
Owner

namin commented Aug 21, 2014

commit 40a339d should partially address performance issues by using mounting instead of downloading to share data with the container. still no container re-use though.

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

2 participants