Switching from write through to write behind automatically

Hi,
We are considering a Coherence solution to protect a customer facing application from outages due to database failures. This is for a financial company and the monetary value of each transaction is large and we want to provide 100% guarantee against data loss while not incurring any outages. We want to provide a write-through persistence to the database through Coherence which can switch to a write-behind automatically at runtime if the database persistence fails. Is this doable automatically and would it solve the problem I am trying to solve without losing any inflight transactions? Are there any real customer cases that were successful in achieving this using Coherence?
Thanks
Sairam
Edited by: SKR on Feb 16, 2012 3:14 PM
Edited by: SKR on Feb 16, 2012 3:15 PM

SKR wrote:
Jonathan.Knight wrote:
Hi Sairam
I know you can change the write-delay in JMX for a cache using write-behind but I pretty certauin you cannot make a write-through cache suddenly become a write-behind cache.
I'm not sure why you think changing from write-through to write-behind will allow you to guarantee 100% no data loss - do you mean no loss of updates to the DB or no loss of data in the cache cluster? There are certainly scenarios that can occur where you can loose data from either the cluster or the DB that write-through or write-behind will not save you from. Presumably you want to use write-behind to allow for the DB to go down, although you will still need to configure Coherence to properly retry failed write-behind calls CacheStore behaviour on failure. What happens to your data if you are using write-behind and you loose a partition from you cluster (i.e. you loose a physical machine or two or more JVMs in a short space of time) - you have data loss - you cannot guarantee against this you can only mitigate it and have a recovery policy/procedure.
JKJK,
Thanks for your reply. I must have explained the scenario better. What we are trying to do is to have our transactions commit to the database synchronously using write-through, so that during normal operation, the data will be committed, persisted and durable in the database. But our RW database becomes a single point of failure and if some problem occurs to the database during the peak load time, we run the risk of an outage till we fix the database problem or failover to the standby (We don't have RAC architecture or automatic failover and the manual switchover takes about 10 - 15 mins minimum). We want to avoid this by providing a cache-only operation mode during such a failure, where the customers can continue to transact and the writes will get queued in the cache. I do understand that losing both the database and the cache or losing the primary and the backup in the cache would result in a data loss. But I am assuming such a dual failure is rare.
We do not want to run write-behind all the time but only during the database failure window. From what you mentioned, it seems the runtime switching from write-through to write-behind is not available as an option.
SairamHi Sairam,
I would suggest that you configure write-behind to have a fairly short write-delay, and you only return a confirmation to the client
- either after the write-behind succeeded (you can use a backing map listener to listen for the removal of the decoration which meant that the entry was dirty)
- or if the database went down (noticeable from the failure), then it is up to you whether you send a confirmation which also mentions that it is not persisted to disk yet, or not at all
Best regards,
Robert

Similar Messages

  • Transactional Caches and Write Through

    I've been trying to implement the use of multiple caches, each with write through, all within a transaction.
         The CacheFactory.commitTransactionCollection(..) method only seems to work correctly if the first transactionMap throws an exception in the database code.
         If the second transactionMap throws exceptions, the caches do not appear to rollback correctly.
         I can wrap the whole operation in a JDBC transaction that rolls back the database correctly but the caches are not all rolled back because they are committed one by one?
         For example, I write to two transaction maps, each one created from separate caches. When commiting the transaction maps, the second transaction map causes a database exception. It appears the first transaction map has already committed its objects and doesn't roll back.
         Is it possible to use Coherence with multiple transaction maps and get all the caches and databases rolled back?
         I've also been trying to look at using coherence-tx.rar as described in the forums within WebLogic but I'm getting @@@@@ Failed to commit: javax.transaction.SystemException: Could not contact coordinator at null+SMARTPC:7001+null+t3+
         (SMARTPC being my pc name)
         Has anybody else had this problem? Bonus points for describing how to fix it!
         Mike

    The transaction support in Coherence is for Local     > Transactions. Basically, what this means is that the
         > first phase of the commit ("prepare") acquires locks
         > and ensures that there are no conflicts. The second
         > phase ("commit") does nothing but push data out to
         > the caches.
         This means that once prepare succeeds (all locks acquired), commit will try to copy local data into the base map. If there is a failure on any put, rollback will undo any changes made. All locks are cleared at the end.
         > The problem is that when you are using a
         > CacheStore module, the exception is occurring during
         > the second phase.
         If you start using a CacheStore module, then database update has to be part of the atomic procedure.
         >
         > For this reason, write-through and cache transactions
         > are not a supported combination.
         This is not true for a cache transaction that updaets a single cache entry, right?
         >
         > For single-cache-entry updates, CacheStore operations
         > are fully fault-tolerant in that the cache and
         > database are guaranteed to be consistent during any
         > server failure (including failures during partial
         > updates). While the mechanisms for fault-tolerance
         > vary, this is true for both write-through and
         > write-behind caches.
         For the write-thru case, I believe Database and cache are atomically updated.
         > Coherence does not support two-phase CacheStore
         > operations across multiple CacheStore instances. In
         > other words, if two cache entries are updated,
         > triggering calls to CacheStore modules sitting on
         > separate servers, it is possible for one database
         > update to succeed and for the other to fail.
         But once we have multiple CacheStore modules, then once one atomic write-thru put succeeds that means database is already updated for that specific put. There is no way to roll back the database update (although we can roll back the cache update). Therefore, you may end up in partial commits in such situations where multiple cache entries are updated across different CacheStore modules.
         If I use write-behind CacheStore modules, I can roll back entirely and avoid partial commits? Since writes are not immediately propagated to the database? So in essence, write-behind cache stores are no different than local transactions... Is my understanding correct?

  • Auto switch from tray 1 for envelopes to tray 2 for letters on HP Officejet Pro 8500A Premium

     Hi I have a HP Officejet Pro 8500A Premium e-All-in-One Printer - A910n My Operating System is XP Media Center.  I haven't been able to get it to switch from one tray to the other automatically. Also  it only remembers 1 type of paper at a time. I can't get it to show in Properties, Paper  available, more than one type of paper. I open device settings, Form To Tray Assignment, Printer Auto Select :Letter.     Tray 1 : Letter   Tray 2 : Letter.   Now I change Tray 1 : to Envelope #10  click apply, click ok, it closes out. I open the Properties back up & Tray 1 : is back to letter.  Is there a way to get the printer to remember the it is set up with 2 Trays with 2 different types of paper ? I think the problem lies with the Printer Auto Select : But I am not sure. I would like to be able to print an address on an envelope when working in works. Without having  to manually change the Tray settings. Does any one Know How to set this up ? Thanks in advance for taking the time to read this issue.
    This question was solved.
    View Solution.

    Hi MrHope,
    Make sure that the printer is set to have tray 2 as the default tray, and then try setting the paper types for each tray in the printer settings.
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c02917871
    I am an HP employee.
    Say Thanks by clicking the Kudos Star in the post that helped you.
    Please mark the post that solves your problem as "Accepted Solution"

  • What triggers a write-through/write-behind of entry processor changes?

    What triggers a write-through/write-behind when a cache entry is modified by a custom entry processor (subclass of AbstractProcessor)? Is it simply the call to Entry.setValue() that triggers this or are entry modifications detected in some other way?
    The reason I am asking is that in our Coherence cluster it looks like some entry modifications through entry processors have not triggered a write-behind, and I see no logical pattern as to which ones have and which ones haven't except that some specific entries are just never written to our database. We see from our logs that our implementation of the CacheStore.store() method is not called in these cases, and we also see that the cache entry has been modified successfully.
    We are using Coherence 3.3 on a three machine cluster with 8 nodes on each machine, accessed from clients through a TCP extend proxy.
    Regards,
    Mikael Carlstedt
    mBlox Inc
    Edited by: user3849225 on 16-Sep-2010 04:57

    Hi Mikael
    Calling setEntry() will result in a call to the CacheStore.store() method unless the value you are setting is the same as the existing entry value. If you are using writebehind then storeAll() will be called instead of store() if there are multiple entries waiting to be stored. Writebehind will also coelesce entries so that only the last entry for a given key will be stored.
    What patch level are you using?
    Paul
    Edited by: pmackin on Sep 17, 2010 12:08 AM

  • Sync problems after switch from Windows to Mac; cannot read/write error msg

    I'm not sure if this is a hardware or software issue.
    I recently switched from a PC to a Mac. To move my iTunes files (50GB) I simply dragged and dropped them from my external HD to my new computer. I know that Apple does not recommend this process, but when I needed to move my library between drivers earlier this year, it was the only way I could do it without getting an error message that killed the process.
    Moving the files seemed to be a success. Everything appeared in iTunes, I was able to play the music, etc.
    I then tried synching my iPod (Classic 160 GB – I think 5th gen, it’s about 3 years old) on the new computer. I got some message that said you can only have one iPod per account and that I would have to wipe the iPod before syncing. I let it do that.
    Here's where problems began:
    With a few gigs to go in the sync I got a message that says something to the effect that iTunes cannot read or write to the iPod. Even though must of the library had been transferred to the iPod, before disconnecting the iPod iTunes wiped all but a few hundred megs worth of music from it. I've tried restoring the iPod a few times but that has had no effect. The first time I tried to sync the iPod it was formatted for Windows. I have reformatted it for Mac.
    Also noteworthy is that the first 3/4ths of my library copies very quickly -- 1GB a minute -- but then it eventually slows down to where 100 MB takes 10 minutes. It copies the files in a different order every time, so it doesn't look like it's getting hung up on the same files every time.
    In case I had a corrupted file, I deleted all the files added to the library since my last successful sync.
    Suggestions?
    Should I just go to the nearest Apple store and beg for mercy?

    Hi!
    same problem here.I can use around 30G of my iPod Classic 160G.If i try to upload more than that it will take very long time and finally freezes.
    Have no idea what to do..

  • Write-through limitation and putAll

    Please find the quote below from developer guide, particularly this one In other words, if two cache entries are updated, triggering calls to CacheStore modules sitting on separate cache servers, it is possible for one database update to succeed and for the other to fail.If a putAll is called on a cache, will it result in one CacheStore.storeAll or many storeAll triggered from different coherence nodes/servers? (assume a distributed topology coherence 3.7.1)
    Will the store transaction failure lead to putAll transaction failure?
    Are there any patterns that shows how this coherence works with typical databases?
    14.7.2 Write-Through LimitationsCoherence does not support two-phase CacheStore operations across multiple CacheStore instances. In other words, if two cache entries are updated, triggering calls to CacheStore modules sitting on separate cache servers, it is possible for one database update to succeed and for the other to fail. In this case, it may be preferable to use a cache-aside architecture (updating the cache and database as two separate components of a single transaction) with the application server transaction manager. In many cases it is possible to design the database schema to prevent logical commit failures (but obviously not server failures). Write-behind caching avoids this issue as "puts" are not affected by database behavior (as the underlying issues have been addressed earlier in the design process).

    gs100 wrote:
    Thanks for the input, I have further questions based on these suggestions.
    1. Let us say one of the putAll fails we would know that it has failed due to underlying one or more store/storeAll. And even if we rollback the coherence transaction, the store/storeAll that succeeded would not be rolled back automatically, is that correct? If true, this means that it would leave the underlying DB/store in the inconsistent state with that of in-memory cache?I guess that is one of the reasons why the transaction framework does not support cache stores... also, write-behind would coalesce updates which would have funny consequences with regards to the transactional context...
    2. How do we get the custom implementation of putAll, that you suggested to handle specific errors? any pointers on this would be helpful.I guess it is not going to be posted, the Coherence team may or may not add something which is a bit more deterministic with regards to error.
    A few aspects of Coherence behaviour (a.k.a pitfalls) which you need to be aware of to be able to implement your own solution:
    Exceptions propagating back to the client can happen in:
    - entry-processor (not for putAll specifically)
    - result serialization code (not for putAll specifically, but for processAll/aggregate for example)
    - deserialization code (indexes/filter-based backing map listeners/cache stores lead to deserialization even for putAll)
    - triggers (intentionally, too)
    - cache stores
    There is no place where you could catch any exceptions from inside the NamedCache call, so they will come out.
    Coherence may execute the operation on one thread per partition or one thread per multiple partitions, but never on multiple threads per partition. This means there may be multiple exceptions even from a single storage node, but only at most one exception would be generated per partition (starting with 3.5).
    If you send multiple partitions with the same NamedCache call, you can lose exceptions as you wouldn't know if an exception would have or wouldn't have happened with a partition if it was sent alone instead of together with another on the same node.
    As you need to be able to return all exceptions from your method call, you have to produce and catch all of them and collect them otherwise you would lose all but one. To produce and catch all exceptions you have to produce all exceptions independently, i.e. different partitions must be operated on independently.
    To send an operation to a single partition only, you can separate the operations to different partitions by separating the keysets for different partitions with key-based operations, or applying a PartitionedFilter for filter-based operations.
    It is up to you where and how you iterate through the partitions. You can do it on the caller, you can do it on storage node from an Invocable sent via an InvocationService (in this case you can be either optimistic with ownership or chase a partition).
    3. Because we are thinking putAll that coherence implemented is most optimized (parallelism). I am not sure how the custom implementation can be as optimal (hope we don't end up calling one by one).You cannot implement it as optimally as Coherence itself does as it interleaves operations (Messages) to independent partitions/nodes (does not have to wait for the return message) from a single thread without waiting for the responses from individual nodes/partitions.
    You can either parallelize operations to multiple threads, or do the iteration on the single thread at the cost of higher latency.
    Best regards,
    Robert

  • Write through and CacheStore

    Hi,
         I'm running a near cache implementation, with the front being a local cache and the back being a distributed cache. The distributed cache has a local cache and a read-write-backing-map-scheme for persisting each cache to disk every t minutes (for backup purposes - we still use a cache in memory).
         I have a few questions about the Write through capabilities and CacheStore so as to better understand what's going on here:
         1. We only need to store the data to disk for backup in case of complete cluster failure (for example, all n machines in our cluster go down). Right now my implementation of the CacheStore has one line which reads "return null" for the following methods:
         load(..)
         loadAll(..)
         Is there a more efficient/effective way to write to disk and ignore reads if item does not exist in distributed map rather than extending CacheStore and returning null for all methods noted above?
         My reading and writing to disk occurs using the ExternalizableHelper class, thx for this nice work.
         2. How are CacheStore's instantiated initially? Since we want each cache (say we have two different caches here for simplicity) backed up to file every t minutes, do we have to have a separate CacheStore object for each cache? What is the best practice to attach a cachestore to a particular cache?
         For example, I start two Tangosol instances, one on machineA and one on machineB, both storing data as per my configuration. The 2 caches being used are "cacheA" and "cacheB". So when I start the two Tangosol instances, I have to instantiate CacheStore twice so that I can separately write "cacheA" and "cacheB" to their own separate files.
         3. When backup to disk occurs, is there any removing of items from the distributed cache?
         4. I'm not completely sure on the write delay here. What if an item in the cache is just added once, and no updates occur on it (ie. just one put, and 0+ gets). After a specified amount of time, will this be written to disk, or does an update on this object in the cache have to occur before this item can be added to the write queue and eventually written to disk? Once an item is added for the first time, does this trigger the update time for this object to be the first write time?
         Thanks,
         - Noah

    Hi Noah,
         1. No, load() and loadAll() returning null is the most effective way of implementing this.
         2. You can pass the cache name as a constructor parameter - see Parameter Macros in the Coherence User Guide.
         3. No, nothing is removed from the cache
         4. Writes are only triggered by put()'s.
         For more information please take a look at this forum post: <a href = "http://www.tangosol.net/forums/thread.jspa?threadID=445&tstart=0">What is Read-Through/Write-Through/Write-Behind Caching? </a>
         Regards,
         Dimitri

  • Execute RFC Write through VB6.

    Hello,
    I have installed the SAP Netweaver trial version (Installation Number "Initial") .
    I can connect to SAP through vb6 and execute an RFC to download and view data (RFC_READ_TABLE).
    I am having a hard time trying to execute a "write" RFC to write data into SAP. Obviously I may be doing something wrong, but, my question is, can you confirm I should be able to "write" to the trial version? If so, can you point me to some vb6 examples for this? Would I be better trying to switch to the developer version?
    Thanks,
    Steve

    Thanks for replying.
    I used the default log in that the installation instructed me to use (SAP*), but then found in the help a BCUSER log in which I think should supply me with appropriate permissions.
    I suspect it is more likely that my coding is at fault. Could you point me to vb6 RFC write examples? Can I execute a command to view a list of suitable write RFC's to experiment with in SAP?
    Thanks,
    Steve

  • Write-through Cache behavior during Transactional Operation

    If a put is called on a write-through cache during a transaction(with Optimistic Read-Committed settings) that involves multiple caches some set to write-through and others to write-behind, when will the store operation on the corresponding CacheStore be attempted?
         a) Immediately after the put() is called on the cache but before the transaction commit
         or
         b) Immediately after the transaction is committed irrespective of when the put is called

    Hi Abhay,
         The backing map (in this case, <tt>com.tangosol.net.cache.ReadWriteBackingMap</tt>) is responsible for calling the CacheStore implementation. When "commit" is called, Coherence will synchronously send the data to the backing map; the backing map then determines what to do with the data. In the case of ReadWriteBackingMap, it will either (depending on its configuration) synchronously call CacheStore (meaning that a store exception will interrupt your transaction) or queue the update for later (meaning that any store exception will occur after the cache transaction has completed).
         In 3.0, the <rollback-cachestore-failures> element under <read-write-backing-map-scheme> controls whether CacheStore exceptions are propagated back to the client. If you are using a release prior to 3.0, please see this FAQ Item on CacheStore Exceptions.
         Jon Purdy
         Tangosol, Inc.

  • Pre-load a write-through cache

    This probably is a common problem.
    I want to use write-through cache to keep the cache and the db in sync. But at application start-up, I'd like to pre-load the cache. Is there anyway I can disable the write-through behavior during pre-loading, and enable it after pre-loading is complete?

    Wouldn't you just be better to load the data into the database first, and then just query it to get it into the cache? That way, the cache and the db are 'in sync', and no write operations have occurred; also, you don't need to 'flip' any cache settings. Subsequent updates to cache items would then be written to the database as normal.
    Surely if the data wasn't in the db first, you'd end up with a large 'write' operation to place it there once you've loaded the cache and 'flipped' it over, which could be quite a lengthy process. I can't see the advantage of this over putting the data in the db first?
    I'd be interested to know more about your specific use-case, as I'm just to embark on a similar 'loader' program. In my case, I was planning on loading the db first. I'd be interested in any alternative approaches and the reasoning behind them (or, likewise, if you can't actually do it the way I was planning! :)).
    Steve

  • OS X switch to azerty when I write in Japanese/Chinese...

    I write japanese chinese and english on a daily basis and got used to it.
    Problem is that recently my mac started using the AZERTY input when I am typing chinese (I had reinstalled Mac OS), scrambling all my habits.
    Where do I set the input to QWERTY?
    I don't see any options in "International".

    Went to a fellow expat to try on his macbook pro he bought recently (unibody, Snow Leopard inside), it doesn't seems to make this smart switching thing... we tried switching from US to japanese then to french then to chinese then french then chinese again and it doesn't use the azerty layout.
    If it had worked, I would have gladly shelled out the 30 bucks for the upgrade as it could have solved the problem for me if it switched for that godforsaken azerty back to qwerty...
    I tried with different chinese input like wutabc or more exotic ones like jianyi and it still confuse A with Q and so on...
    This smart switching is on by default or am I just out of luck?

  • Help! mail dissappears when switching from junk training to automatic mode

    I'm a new Mail user recently switched from 20 years of Eudora. I'm using Mail with a standard POP account. I've had no trouble setting up mailboxes and importing my old mail.
    I've been using junk filtering in training mode for the past few weeks and want to switch to automatic mode. When I tried doing this, all of my inbox messages suddenly disappeared. I quit mail and rebuilt my inbox and found myself with thousands of duplicated messages. I'm using Andreas Amann's remove duplicates script to clean up my inbox (it's taking forever but working!)
    My inbox has about 7000 messages currently. My practice with Eudora has always been to keep the current year in the inbox and archive at the beginning of the new year. I'd like to continue this with Mail.
    A couple questions:
    1) will rebuilding a mailbox cause duplicates? When should one use rebuild?
    2) do I just need to be more patient and let mail do its thing when switching from training mode to automatic?
    3) is 7000 messages considered too many for a single mailbox?
    Any help much appreciated. Many thanks!
    --dhl
    Powerbook 15" Aluminum   Mac OS X (10.4.8)  
    Powerbook 15" Aluminum   Mac OS X (10.4.5)  
    Powerbook 15" Aluminum   Mac OS X (10.4.5)  

    1) will rebuilding a mailbox cause duplicates?
    No.
    When should one use rebuild?
    This question doesn’t have a simple answer in the case of Mail 2.x and POP accounts.
    2) do I just need to be more patient and let mail do its thing
    when switching from training mode to automatic?
    I think so.
    3) is 7000 messages considered too many for a single mailbox?
    There is a limit on the overall size of individual mailboxes rather than on the number of messages stored in them -- see Overstuffed mailbox is unexpectedly empty.

  • Should OS/FileSystem caching be write-through?

    I have a question. I use Ubuntu. Should I mount my filesystem (which holds BDB's content) with "-o sync" option? That is, should my file system cache be write-through?
    I have this question because, if I turn on the logging feature in Berkeley DB but let the file system cache be write-back, I don't exactly know if the log is properly flushed to the disk or not.

    Thanks George. I agree that mature applications would be better off mounting their filesystem with "-o sync" option.
    But here is a thing: I ran an example test case where I inserted 10 million key-value pairs with logging enabled, and saw that the average response time per insertion was 10 milli seconds, and I did the same experiment with logging disabled and saw that it too took 10 milliseconds per insertion on an average.
    For the experiment with logging enabled, I create the environment with DB_INIT_LOG and DB_INIT_TXN flags but don't surround the insertion requests with txn_begin() and txn->commit(). I guess this way of doing insertions is called autocommit. I am hoping I am doing this experiment right.
    Thanks for the pointers about set_flags() and DB_TXN_NOSYNC, I am going to look them up.

  • I have a MacBook Air, it automatically minimises and switches from the screen I am in for some reason ?

    I have a MacBook Air, it automatically minimises and switches from the screen I am in for some reason ?

    This problem is often caused by "Google Drive." If it's installed, I suggest you first check for an update. If that doesn't solve the problem, remove it according to the developer's instructions. You may need to boot in safe mode to do so. Back up all data before making any changes.
    If you use Google Drive and don't want to remove it, then try deselecting the option in its preferences to "show status icons." According to reports, that may be enough to stop the Finder from crashing.

  • I have iWeb '08 and just switched from Mobileme to GoDaddy and using Filezilla.  Now when I make changes through iWeb it doesn't actually publish to my desktop folder.  In fact, it doesn't publish at all but says that it did.

    I have iWeb '08 and just switched from Mobileme to GoDaddy and using Filezilla.  I also just upgraded to Lion.  Now when I make changes through iWeb it doesn't actually publish to my desktop folder.  In fact, it doesn't publish at all but says that it did.  How can I make changes in iWeb and publish to a folder?

    Choose the destination in the publish settings page as shown in the second example on this page...
    http://www.iwebformusicians.com/iWeb/Publish-Website.html

Maybe you are looking for

  • Can't get more than one mac online at once with aiport express

    Hi, I hope someone can help - I've searched the forum and been on the phone to level 2 support at Apple for 6 hours to no avail! I have a D-Link DSL 300G+ modem connected to an airport express and can connect to the internet fine on just one mac if I

  • Pasting urls in e-mails are not in blue text. Recipiants cannot click on sites. I'm using latest version of Firefox !

    I'm using the latest Firefox. I use hotmail and yahoo mail accounts. When I type an email and paste or type a website...Ie: http//www....the text does not appear in blue text. Therefore the recipients of my emails are not able to click on the website

  • CD/DVD Player keeps ejecting,

    My Sat A215-S7416, CD player keeps ejecting, it started after I remove the virus Trojan Fake Alert. Any ideas

  • Nokia N8 as a webcam

    Hi, i have a nokia n8 and am using mobiola to make my phone into a webcam. But my friends say that the quality of the video is not good when im on skype. the camera is meant for hd so i dont know why this is happening. what would be the best software

  • Email adress bull crap!!!!!

    so my buddy sent me his email adress but spelt it wrong and i ended up saving it and erased it then saved his correct email adress. well when im sending an email and type in his name all of the incorrect email adresses that i DELEATED are still shown