markfinger / python-react

Server-side rendering of React components
MIT License
1.62k stars 116 forks source link

Could you add a bit of info to the docs about costs and benefits? #14

Closed andybak closed 9 years ago

andybak commented 9 years ago

I'll dig around and figure this out myself but it would be useful to add some more info on the following to the docs:

  1. Does it launch and initialise node or v8 on every render call? What's the performance like?
  2. If yes to (1) - is there a way to connect to an existing persistent node server to reduce this?
  3. Is there any internal caching? If not what's the recommended way to use Django's caching with django-react?
markfinger commented 9 years ago

Everything's in a bit of a state of change currently, so things will change over the next few weeks. But currently:

1, A server is spun up to render components on demand.

2, In theory. The server in django-react was a prototype for something that's being moved into django-node (just landed on master yesterday). The general idea is to have a single node process sitting alongside python which performs a bunch of tasks on demand. The server controller will first try to connect to a pre-existing server on the address/port it's looking at, falling back to opening a background subprocess.

3, Caching isn't really something I've looked at, so I'd suggest relying on Django's caching layer and and preserving the rendered output. It would be nice to have some automatic integration into Django's cache, if only to remove the need to explicitly opt-in.

I'll leave this open until everything settles and the docs get cleaned up.