Giter Site home page Giter Site logo

Comments (5)

scottoffen avatar scottoffen commented on May 15, 2024 1

That while loop takes up a lot. I already changed it to poll the server at a predefined number of seconds, but that isn't in a release yet. I'll be changing it again soon to something more performant, so expect that to change.

Either way, when idle, the server takes up 0% cpu.

from grapevine.

scottoffen avatar scottoffen commented on May 15, 2024

When the server is idle (no requests) it should be taking up 0% CPU. Can you post some sample code for me to take a look at?

from grapevine.

sanchezpablo avatar sanchezpablo commented on May 15, 2024

Hi @scottoffen I tried with the sample provided in the repository, but the same result, so I decided to left a comment, maybe it's something else... I've tried also with other embedded webserver (https://github.com/unosquare/embedio) and the CPU is 0% when the server is idle.

If you need more information, let me know.

from grapevine.

scottoffen avatar scottoffen commented on May 15, 2024

How are you blocking the thread while the server is running? If you are just benchmarking, use this method:

server.Start();
Console.ReadLine();

image

from grapevine.

sanchezpablo avatar sanchezpablo commented on May 15, 2024

I used the server.Run() as in the sample, when I use server.Start() the CPU gets down to 0% when idle. So the server.Run() does something else in the background?

        public static void Run(this IRestServer server)
        {
            server.Start();
            while (server.IsListening) { }
        }

Probably the while loop inside...

Thanks!

from grapevine.

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.