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

What do you mean "R shared library is not reentrant and hence should not accessed from multiple threads" #7

Open
sittimunirahar opened this issue Nov 27, 2019 · 1 comment

Comments

@sittimunirahar
Copy link

Hi, this is more like a question. I have run my R code in Django, however as you said i cannot use multithreading. But I need multithreading cos it's too slow without it. How to run the r code without manage.py runserver --nothreading?

@Sleepingwell
Copy link
Owner

Sleepingwell commented Nov 27, 2019

A WSGI server (which Django is) can have multiple workers. I think some WSGI implementations run the workers in threads, which could cause problems (as each thread uses the same 'instance' of R). However, many fork which is OK. At this level, we are talking about handling multiple requests simultaneously.

Parallel processing inside R is a different issue and If you want to speed things up for a single request, there are lots of ways/packages for doing it. See, for instance this task view. I have not done a lot of it (I tend to do it myself in C++ code internally), but I have also used doParallel with great success a few times.

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