2
7 Comments

Any one using Kestrel in production?

I am curious about the real life experiences of those who use Kestrel in production.
I developed a microservice using asp.net core kestrel. Each service loads all the records of a category to the memory at startup. All requests are answered by this loaded class. Instead of sending a request to Redis, I use the class I created. Is this solution right for you?

posted to Icon for group Developers
Developers
on August 2, 2020
  1. 1

    You should be good. Nothing wrong with caching in memory - it will definitely provide faster response times compared to Redis. We use ASP.NET Core in production, with the NGINX web server running in front of it as a Reverse Web Proxy. Static content is being served by NGINX directly, while dynamic content is being proxied to ASP.NET Core Kestrel instance

    1. 1

      Thank you for the answer actually i'm afraid of memory leaks and deadlocks.

      1. 1

        The site is nicely done and response time is in milliseconds. So it looks like you are fine. I would not worry about deadlocks for now, unless you are getting tons of traffic :) I would just keep an eye on the logs and log all unhandled errors, and you would know if some unexpected error would come up. P.S. love the name play i.e. "Apple-Oranges" as "AO"

  2. 1

    I'm running a microservice (web api) in production at my day job that's using Kestrel behind an NGINX reverse proxy. It's pretty rock solid. I load tested it up to 100 requests/second and it didn't even blink, even on pretty minimal hardware. It sounds like your use-case is just serving preloaded data, nothing too taxing on resources, so I would imagine you'll be fine.

    I will say though, this is basically what Redis is made for. Is there a reason you're trying to avoid calls to Redis?

    1. 1

      I'm using haproxy for load balancing and high availability. Each category has 100-200 product with 40-50 Feature data. I want to make users filter or sort every data.

      https://www.aocompared.com/FeatureSet?featureSetId=4

      All database loaded in to memory and request get result from memory loaded class.

      My class added as a singleton service and using in controllers with dependency injection. When class loaded it consume 100MB memory. I made load test to check memory usage and check for deadlocks. Everything was fine.

      I dont use Redis because using class is easy for filtering and sorting also have latency advantage

      1. 1

        If this works for you, that's great, but it seems a little unorthodox. Like, I have no idea how you will scale this if you grow. Well, other than vertically, with more and more RAM. Considering this is a filtering service, the latency between Redis and your code will not be the bottleneck (unless they're in different datacenters or something).

        Scalability comes from abstracting applications into smaller, stateless pieces. I don't see how that would be possible when you're literally keeping an entire database in RAM and referencing it that way. For example, what happens if a product or category is updated? Or if you wanted to include inventory levels/alerts on the page? You'd have to restart the service(s) so they all repoll and get the latest information. Or... they poll regularly, which kind of seems to defeat the point of your setup.

        It just seems like an overengineered solution to a relatively solved problem.

        1. 1

          Thank you for reply.

          My goal is make comparison tool for products which have complex technical specs. And give users to ability to filter and short every feature.
          Redis store key value pairs not suitable for filtering or sorting and if I use database for every query it will be slow or require more resources.
          My class not load whole database into memory. Instead of that loads required data and creates prepared views. Uses less memory and cpu when listing, filtering or sorting.
          To scale I can add more web vms and separate by product categories.
          When I add or remove new product it notify to all microservices. Microservices re create prepared views from database.
          I am curious about;
          What happens to memory usage under load? Will Kestrel create new singleton class as the number of users increases?
          If too many filtering and sorting requests from the controllers to the singleton class are gone, will a dead lock occur?

  3. 2

    This comment was deleted 3 years ago.

Trending on Indie Hackers
Priorities for launching a SaaS solo, with no budget User Avatar 144 comments I thought I was building a news visualization tool. Users thought it was a catch-up tool. User Avatar 38 comments I Rejected a $15K Acquisition Offer for My Multi-Agent IDE — Here's the Full Breakdown User Avatar 29 comments I built a tool directory that doesn't pretend every founder has the same needs User Avatar 19 comments 5 Books, Make Smarter User Avatar 10 comments Why founder-led outbound breaks the moment you try to delegate it User Avatar 7 comments