View Issue Details

IDProjectCategoryView StatusLast Update
0006199Talerexchangepublic2021-09-02 18:14
Reporterfefe Assigned ToChristian Grothoff  
PrioritynormalSeveritytrivialReproducibilityhave not tried
Status closedResolutionfixed 
Product Version0.7.0 
Target Version0.8Fixed in Version0.8 
Summary0006199: loading the terms of service files into memory seems wasteful
DescriptionThis is about load_terms in exchange/src/mhd/mhd_legal.c.

Basically, the function loads a bunch of files into memory. Does a stat to find the length, then mallocs that much (without bounds!) and reads the file contents into that buffer.

These files will usually not be very large so it probably does not matter much. However, I would suggest using mmap instead of malloc+read. In both cases you get a pointer, but it puts less strain on the OS and the memory usage of your application.
TagsNo tags attached.

Activities

Christian Grothoff

2020-04-22 15:07

manager   ~0015730

If we REALLY cared about performance, we could even use MHD's sendfile() here, but then we'd burn an fd per ToS/PP-file.

Christian Grothoff

2020-04-22 22:48

manager   ~0015738

Moreover, if we REALLY care about performance, we should probably keep the compressed response in RAM instead of re-doing the compression per request. That'll be worse for RAM, but almost certainly beats re-doing gzip all the time.

Christian Grothoff

2020-07-21 21:33

manager   ~0016494

Implemented in d9e871b5..6d52922c

Christian Grothoff

2021-09-02 18:14

manager   ~0018248

Fix committed to master branch.

Related Changesets

exchange: master 6d52922c

2020-07-21 23:27

Christian Grothoff


Details Diff
mmap() ToS/PP and pre-compute compressed replies (fixes 0006199) Affected Issues
0006199
mod - src/mhd/mhd_legal.c Diff File
mod - src/testing/test_exchange_api.conf Diff File

Issue History

Date Modified Username Field Change
2020-04-22 13:30 fefe New Issue
2020-04-22 13:30 fefe Status new => assigned
2020-04-22 13:30 fefe Assigned To => Christian Grothoff
2020-04-22 15:07 Christian Grothoff Note Added: 0015730
2020-04-22 22:48 Christian Grothoff Note Added: 0015738
2020-04-22 23:14 Christian Grothoff Assigned To Christian Grothoff =>
2020-04-22 23:14 Christian Grothoff Status assigned => confirmed
2020-04-22 23:14 Christian Grothoff Target Version => 0.9
2020-07-16 15:17 Christian Grothoff Assigned To => Christian Grothoff
2020-07-16 15:17 Christian Grothoff Status confirmed => assigned
2020-07-21 21:33 Christian Grothoff Note Added: 0016494
2020-07-21 21:33 Christian Grothoff Status assigned => resolved
2020-07-21 21:33 Christian Grothoff Resolution open => fixed
2020-07-21 21:33 Christian Grothoff Fixed in Version => 0.8
2020-07-21 21:33 Christian Grothoff Target Version 0.9 => 0.8
2021-08-24 16:23 Christian Grothoff Status resolved => closed
2021-09-02 18:13 Christian Grothoff Changeset attached => Taler-exchange master 6d52922c
2021-09-02 18:14 Christian Grothoff Note Added: 0018248