Code Monkey home page Code Monkey logo

Comments (8)

andrewgodwin avatar andrewgodwin commented on May 27, 2024

The docs already say not to use DatabaseChannelLayer, but I'll reinforce it. It's really not fast with the built in Django stuff (which chunks things into 4KB chunks to serve them!)

I'm going to make it re-chunk them up to a bigger size, but yes, try the Redis backend or the in memory backend if you're just using runserver.

from channels.

flo-dhalluin avatar flo-dhalluin commented on May 27, 2024

Ok, I noticed it's not fast, and I am good with it (after all, debug mode ..), but it is not usable at all as it crashes the server. I am talking about an angular app so quite large assets (default main angular.js file is about 1Mo, add a few more dependencies ... ).

I'll see if can work on daphne to handle static files directly from twisted, maybe with static_dir/url option ?

from channels.

andrewgodwin avatar andrewgodwin commented on May 27, 2024

No, just use the in memory backend, it should be faster than normal runserver (channel layer asgiref.inmemory.InMemoryLayer)

from channels.

andrewgodwin avatar andrewgodwin commented on May 27, 2024

Obviously, in production, you wouldn't serve static files through Daphne anyway - I just want to make sure runserver is usable.

from channels.

flo-dhalluin avatar flo-dhalluin commented on May 27, 2024

All right ! much better !
Then why the "Quickstart" guide tell to use the Database layer ? . Obviously I a fast webserver for my statics, channels or not ...

from channels.

andrewgodwin avatar andrewgodwin commented on May 27, 2024

It's there because it's the only one that works with multiple processes and without installing extra things (like Redis). I hope to improve the performance of static file serving on the database backend to at least acceptable levels, though - I'll either get that to an alright level or reword it to suggest redis or memory backends.

from channels.

flo-dhalluin avatar flo-dhalluin commented on May 27, 2024

Wonderful, asgiref.inmemory.ChannelLayer works sufficiently well for my dev/test purposes.

I don't know if it is "large" assets, parallel fetch of them or the combination, but database backed layer fails, quasi consistently.

from channels.

andrewgodwin avatar andrewgodwin commented on May 27, 2024

The database layer needs proper transaction support to correctly do message delivery - given that you were using SQLite, it's likely that it wasn't correctly being fully serialisable and so not working!

I might just dump the database one from the docs entirely, and switch the examples to use InMemory at the start.

from channels.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.