Code Monkey home page Code Monkey logo

Comments (7)

cgrantcal avatar cgrantcal commented on May 11, 2024

Note :
I have tested adding -D OATPP_DISABLE_POOL_ALLOCATIONS.

 * Define this to disable memory-pool allocations.
 * This will make oatpp::base::memory::MemoryPool, method obtain and free call new and delete directly

I see no change to the memory behaviour

Thanks

Conor

from oatpp.

lganzzzo avatar lganzzzo commented on May 11, 2024

Hello @cgrantcal,

OATPP_DISABLE_POOL_ALLOCATIONS is the right guess.

Note that you have to rebuild oatpp module liboatpp in order for this to work.

Please let me know how is your progress.

Regards,
Leonid

from oatpp.

lganzzzo avatar lganzzzo commented on May 11, 2024

@cgrantcal
Update.

I've added a fix for disabling pool allocations. See #49.
Also I made it possible to configure oatpp compiler options from cmake.

So to build oatpp with OATPP_DISABLE_POOL_ALLOCATIONS:
(from oatpp dir)

$ cd build/
$ cmake -DOATPP_DISABLE_POOL_ALLOCATIONS=ON ..
$ make
$ make install

To make sure that oatpp is built with the right options you may add a log oatpp::base::Environment::printCompilationConfig();

So now it should deallocate more memory once load is dropped and connections are closed.

Please let me know if you have more questions.

Best Regards,
Leonid

from oatpp.

cgrantcal avatar cgrantcal commented on May 11, 2024

Hey,

I can see that with that flag enabled:

############################################################################
## oatpp module compilation config:

OATPP_DISABLE_ENV_OBJECT_COUNTERS=OFF
OATPP_DISABLE_POOL_ALLOCATIONS=ON
OATPP_THREAD_HARDWARE_CONCURRENCY=AUTO
OATPP_THREAD_DISTRIBUTED_MEM_POOL_SHARDS_COUNT=10
OATPP_ASYNC_EXECUTOR_THREAD_NUM_DEFAULT=2

I can still see that the memory usage never decreases
memory

In your tests how long does it take before the memory is de allocated?

Thanks

Conor

from oatpp.

lganzzzo avatar lganzzzo commented on May 11, 2024

Hey @cgrantcal ,

Looks like not all pools are disabled. I think it might be a bug.

Can you please specify what load you are running against your service:

  • type of request
  • concurrency level
  • requests per second

Thanks,
Leonid

from oatpp.

cgrantcal avatar cgrantcal commented on May 11, 2024

Hey,

I am making simple post and get requests.
There are about 5 clients hooked up. making about 100 requests a second each for 10 seconds.

Hope that helps.

Thanks

Conor

from oatpp.

lganzzzo avatar lganzzzo commented on May 11, 2024

Hey @cgrantcal ,

I've conducted some tests and results are as follows:

Currently the best results in terms of memory you are able to get with oatpp being built as:

cmake -DOATPP_DISABLE_POOL_ALLOCATIONS=ON -DOATPP_THREAD_DISTRIBUTED_MEM_POOL_SHARDS_COUNT=1 -DCMAKE_BUILD_TYPE=Release ..

In this setup I get:

  • 352 KB on service start.
  • 13.2 MB during the load wrk -t1 -c500 -d10s "http://127.0.0.1:8000/"
  • 5.4 MB when load is dropped

Also memory consumption will grow a bit as the load repeated till some point (due to memory fragmentation).

I'll try to make some memory optimization in future, but for now it is what it is

Best Regards,
Leonid

from oatpp.

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.