aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/gnunet-service-namestore.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-04-25 16:41:22 +0200
committerChristian Grothoff <christian@grothoff.org>2018-04-25 16:41:22 +0200
commit303334e67262bb6121dfbd245c66535f259d08af (patch)
tree1a92109915ffe63b7e2815edc6a6355f4065a48c /src/namestore/gnunet-service-namestore.c
parent3c62493eb1aaa74812bbb79431686d99652417f4 (diff)
downloadgnunet-303334e67262bb6121dfbd245c66535f259d08af.tar.gz
gnunet-303334e67262bb6121dfbd245c66535f259d08af.zip
enable caching private->public key mapping in memory to improve CPU consumption for large zone insertions
Diffstat (limited to 'src/namestore/gnunet-service-namestore.c')
-rw-r--r--src/namestore/gnunet-service-namestore.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index f8ac6c31c..c5a37dcac 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -251,6 +251,12 @@ static struct ZoneMonitor *monitor_tail;
251 */ 251 */
252static struct GNUNET_NotificationContext *monitor_nc; 252static struct GNUNET_NotificationContext *monitor_nc;
253 253
254/**
255 * Optimize block insertion by caching map of private keys to
256 * public keys in memory?
257 */
258static int cache_keys;
259
254 260
255/** 261/**
256 * Task run during shutdown. 262 * Task run during shutdown.
@@ -707,11 +713,18 @@ refresh_block (struct NamestoreClient *nc,
707 ? GNUNET_TIME_UNIT_ZERO_ABS 713 ? GNUNET_TIME_UNIT_ZERO_ABS
708 : GNUNET_GNSRECORD_record_get_expiration_time (res_count, 714 : GNUNET_GNSRECORD_record_get_expiration_time (res_count,
709 res); 715 res);
710 block = GNUNET_GNSRECORD_block_create (zone_key, 716 if (cache_keys)
711 exp_time, 717 block = GNUNET_GNSRECORD_block_create2 (zone_key,
712 name, 718 exp_time,
713 res, 719 name,
714 res_count); 720 res,
721 res_count);
722 else
723 block = GNUNET_GNSRECORD_block_create (zone_key,
724 exp_time,
725 name,
726 res,
727 res_count);
715 GNUNET_assert (NULL != block); 728 GNUNET_assert (NULL != block);
716 GNUNET_CRYPTO_ecdsa_key_get_public (zone_key, 729 GNUNET_CRYPTO_ecdsa_key_get_public (zone_key,
717 &pkey); 730 &pkey);
@@ -1722,6 +1735,9 @@ run (void *cls,
1722 monitor_nc = GNUNET_notification_context_create (1); 1735 monitor_nc = GNUNET_notification_context_create (1);
1723 namecache = GNUNET_NAMECACHE_connect (cfg); 1736 namecache = GNUNET_NAMECACHE_connect (cfg);
1724 /* Loading database plugin */ 1737 /* Loading database plugin */
1738 cache_keys = GNUNET_CONFIGURATION_get_value_yesno (cfg,
1739 "namestore",
1740 "CACHE_KEYS");
1725 if (GNUNET_OK != 1741 if (GNUNET_OK !=
1726 GNUNET_CONFIGURATION_get_value_string (cfg, 1742 GNUNET_CONFIGURATION_get_value_string (cfg,
1727 "namestore", 1743 "namestore",