Sponsored Content
Top Forums Programming Ways to preserve a memory cache Post 302699775 by achenle on Wednesday 12th of September 2012 09:28:09 AM
Old 09-12-2012
How long does it take to recreate your data when it's not cached?

If that's anywhere near as fast as recreating the cache, the added overhead of recreating the cache is wasted.

Also, how much performance are you going to lose when you have to keep cache updates synchronized with a persistent data store? If you need reliability, modifications to the cache can't return until data is sync'd to disk.

Nevermind the cost of writing and maintaining the cache recreation code. What happens when that gets buggy, such as not remaining consistent, or improperly syncing changes to disk?

And FWIW, writing complex code makes it a whole lot harder to meet reliability requirements.
 

10 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Clearing of cache memory

Pls! will someone help me on how to clear my cache memory of my Internet browser Thanks Kayode (3 Replies)
Discussion started by: kayode
3 Replies

2. Solaris

File cache portion of memory on Solaris

I'm looking to get the file cache portion of physical (real) memory on a Solaris workstation (Similar to the Cache: line in /proc/meminfo on some Linux systems): # swap -s; swap -l; vmstat 2 2; echo "::memstat" | mdb -k total: 309376k bytes allocated + 41428k reserved = 350804k used,... (5 Replies)
Discussion started by: Devyn
5 Replies

3. UNIX for Dummies Questions & Answers

High use of cache memory

Hi, I'm running a debian lenny 1GB ram, but with a high I/O. This server has 400IOPS and 3MB/s sustain. So, I noted cached memory use 800MB, buffered memory use 50MB, and no free memory is available. Questions: What does mean such a high cached memory? Who's using this cached memory? Is... (3 Replies)
Discussion started by: iga3725
3 Replies

4. UNIX for Advanced & Expert Users

linux memory buffers & cache usage

18:45:47 # free -m total used free shared buffers cached Mem: 96679 95909 770 0 1530 19550 -/+ buffers/cache: 74828 21851 Swap: 12287 652 11635 Hi all. The below output is from a RHEL 4.5... (0 Replies)
Discussion started by: drummerrob
0 Replies

5. Red Hat

Need to release Cache memory

Right now i am using Red Hat Enterprise Linux AS release 4 and cache memory occupying around 1.5GB mentioned below, total used free shared buffers cached Mem: 2026 2021 5 0 161 1477 -/+ buffers/cache: 382 1644 ... (4 Replies)
Discussion started by: thakshina
4 Replies

6. Solaris

clear cache memory

hi all, i have noticed that my server has 64 GB RAM and i have application in this server but the server has free memory only 15% and utilized 85% however it didn't eat from swap . does any parameter can be configured in kernel to make the system clear memory from cache like linux i found... (4 Replies)
Discussion started by: maxim42
4 Replies

7. UNIX for Dummies Questions & Answers

Clearing memory cache on Linux server

i wish to clear memory cache on a production box and i was wondering what is the worst that can happen if i do? i already tested this on a backup server and everything seemed fine. but i need to know from you experts what are the worst things that can happen when i run it on a real server: ... (5 Replies)
Discussion started by: SkySmart
5 Replies

8. AIX

AIX swap space, physical memory & cache

Hi, I am new to AIX, Can someone please help me how to know the swap space, total physical memory and system cache? We are using AIX 5.3. Thanks! (3 Replies)
Discussion started by: Phaneendra G
3 Replies

9. Programming

Memory and cache access time discrepancy

#include<stdio.h> #include<stdlib.h> #include<sys/time.h> #include<time.h> #include "rdtsc.h" #define SIZE 4*64*1024 int main() { unsigned long long a,b; int arr={0}; int i; register int r; a=rdtsc(); r=arr; b=rdtsc(); printf("1st element Access Cycles = %llu\n",b-a); (2 Replies)
Discussion started by: Vaibhavs1985
2 Replies

10. UNIX for Dummies Questions & Answers

Best ways to get clear info about CPU and Memory

Hello all i did search the web and found allot of answers but im confused what are the best ways to get this info via Linux default commands 1. current Cpu Usage in Percent 2. current Memory Usage In Bytes 3. current Memory Available In Bytes Thanks! (2 Replies)
Discussion started by: umen
2 Replies
cache_set_and_retain(3) 				   BSD Library Functions Manual 				   cache_set_and_retain(3)

NAME
cache_set_and_retain, cache_get_and_retain, cache_release_value, cache_remove -- Routines used to manage cached values SYNOPSIS
#include <cache.h> int cache_set_and_retain(cache_t *cache, void *key, void *value, size_t cost); int cache_get_and_retain(cache_t *cache, void *key, void **value_out); int cache_release_value(cache_t *cache, void *value); int cache_remove(cache_t *cache, void *key); DESCRIPTION
These routines are used to manipulate values added to an in memory cache created by cache_create(3). cache_set_and_retain() Adds value with cost to cache and associates it with key. The caller retains a reference to value that will prevent value from being evicted from the cache until value is released in cache_release_value(). cache_get_and_retain() Fetches value for key from cache and places value in value_out. The caller retains a reference to value that will prevent value from being evicted from the cache until value is release in cache_release_value(). cache_release_value() Releases a reference on value back to cache so that value may be evicted. Signals that the client is not actively using value and will use cache_get_and_retain() before using again. cache_remove() Removes the value associated with key from cache. Note that if the value is referenced by a client, the value will not be finalized until the reference is released using cache_release_value(). RETURN VALUES
All functions return 0 for success and non-zero for failure. The value ENOENT (see errno.h) indicates that a key or value passed as an argu- ment does not exist in the cache. EINVAL is used for invalid arguments. EXAMPLE
The following example attempts to fetch a value from a cache using a key. If the value is not present in the cache then it is created and added to the cache. The value is then used and released back to the cache to allow the cache to evict it when needed. cache_t *mycache; cache_create("com.mycompany.mycache", &cache_attributes, &mycache); void *mykey = my_create_key(); void *myvalue = NULL; if (cache_get_and_retain(mycache, mykey, &myvalue) != 0) { myvalue = my_create_value_from_key(mykey); cache_set_and_retain(mycache, mykey, myvalue, 0); } my_use_value(value); cache_release_value(mycache, myvalue); SEE ALSO
cache(3) Darwin May 7, 2009 Darwin
All times are GMT -4. The time now is 07:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy