OSCAM Cache-EX Tutorial v2.0

There are 2 replies in this Thread which was already clicked 24,014 times. The last Post () by hu016865.

    • Official Post

    OSCAM Cache-EX Tutorial v2.0


    What is Cache-EX ?
    "Cache" - as used in the cardsharing scene, is simply a collection of already used, valid ECM's, collected by your card- and proxy- readers.
    The "Cache-EX" feature in Oscam makes it possible to exchange and merge local collected cache with other Oscam servers.



    Why is Cache useful in general ?
    Quite simple. Even without Cache-EX enabled, Oscam builds a cache by default. Every ECM request done by a client is forwarded to a card or proxy reader.
    All answered ECM's will stay in Oscam's memory for a certain period of time, and will be removed when its TTL (Time to Live) expires.
    On a busy server, you can imagine that there are quite a bunch of valid ECM's stored in memory. All together they are called "Cache".


    When another user requests an ECM for the same channel at the same time, Oscam will automatically return the copied/stored/cached ECM from its local cache, without requesting any reader.
    Every ECM requested is always checked against the available cache first, so the result is a 50% save on your card, based on the 2 users requesting the same ECM.
    OK! I understand the above. Why use Cache-EX on top of the local cache ?
    Cache-EX stands for 'Cache Exchange', and is simply a method to transfer cache from, or to another Oscam server.
    This way, a second server receives and stores the collected cached ECM's into its own memory, and clients can request and use them the same way as described above.


    Also the total cache on the second server (its own + received from 1st server) can be forwarded to a third server)
    When many busy servers merge all cached ECM's, a huge cache will be available saving card-requests on all connected servers.




    How-To setup CACHE-EX
    To start with, Oscam has to be compiled with CACHE-EX support set to ON.


    The protocols that are able, and commonly used to transfer cache with Oscam are: CC-Cam, CAMD35 and Newcamd.
    Cache-EX can be enabled on a protocol with the cacheex=1/2/3 parameter on both users and readers config.


    A connection between a user and a reader is always one way.


    For setting up bidirectional cache transfers between two servers, both servers have to setup a reader and a user, and connect them to each other the same way as with normal CC-Cam, CAMD35 or NewCAMD peers.



    The 3 Cache-EX modes
    Every mode has its own behaviour and interacts different with the connecting server.
    In every configuration, both user and (connecting) remote reader must use the same mode.


    --


    Mode 1
    cacheex = 1 (cachepull)


    In mode 1 OscamA can make use of OscamB's local cache. Every single ECM requested on OscamA will be actively requested (and if available Pulled) from the local cache on OscamB.


    Only cached (none from card/proxy) ECM's can be requested when cacheEX mode 1 is configured on every protocol.


    Request workflow in mode 1:


    OSCam A reader1 has set cacheex = 1
    OSCam B user1 has set cacheex = 1


    OSCam A processes an ECM request from a User.
    => Reader1 checks the local cache,
    => if available => Return local cached ECM.
    => if not available => request is forwarded to OSCam B


    => OSCam B - User1 receives the request
    => User1 Checks the local cache
    => If available => Return local cached ECM to Reader1 (on OSCam A)
    => If not available => Return NOK or Rejected to Reader1 (on OSCam A)


    => OSCam A receives 'Reject' from OSCam
    => Checks local cardreaders and/or proxies
    => etc.


    Cache flow = B ---> A



    --


    Mode 2
    cacheex = 2 (cachepush)


    In mode 2 OscamA actively pushes cache into the local cache of oscamB.
    (local cache + received cache from remote servers)



    The method is clear, but this mode has one hidden 'feature'..


    You can also request normal ECM's (from card/proxy) from the remote server.
    So besides the cache transfers, a cache-ex enabled user can be used to share cards and proxies.


    Nevertheless, I would not advise to use mode 2, because you will run into a grouping problem.
    => Rather use mode-3 and setup a seperate reader/user connection for normal sharing!


    Also the mode-2 sourcecode is less mature as the mode-3 code as i may believe from Oscam experts.


    OSCam A reader1 has set cacheex = 2
    OSCam B user1 has set cacheex = 2


    Cache flow = B ---> A


    --


    Mode3
    cacheex = 3 (reversed-cachepush)


    Same as mode 2, but flow is reversed. The reader sends, the user receives.


    OSCam A reader1 has set cacheex = 3
    OSCam B user1 has set cacheex = 3


    CW-flow = A ---> B




    Which is 'best' ?
    From experience, mode 1 and mode 3 are working good.



    Mode 1
    Pull (from local reader to remote user)



    Will work in all kind of setups, but puts extensive logging into the (default-loglevel) oscam.log file.
    Each requested ECM is actively requested (and often denied) by the remote server's cache, which will create (a lot!) time-out and reject events in the log.
    Therefore on busy servers i would not recommend to use mode 1.
    Because of the fact that no cache is actively pushed, and/or received other than the ones requested, your total cache-size will stay low.
    If you want to 'build' a cache to transfer/push to remote peers, use mode 3 instead. If you only want to use incoming cache as backup for your receiver, you can use mode-1
    No real ECM's (no card/proxy, only cache) can be transferred with cachex=1 enabled.





    Mode 2
    Push (from local user to remote reader)



    Can be used to build cache, ecm's are actively pushed to a second server
    Will also access proxies and card-readers, besides cache-transfer
    Rumor that it contains bugs / less mature code than other modes





    Mode 3
    Reverse - Push (from local reader to remote user)



    Can be used to build cache, ecm's are actively pushed to a second server
    Reverses the stream between reader and user.
    Also group and other parameters have to be applied accordingly
    Commonly used in cardsharing scene






    Typical Setup
    Here's a typical simple configuration to connect two servers with cacheEX thru CC-CAM, BI-directional.


    oscam.reader on OSCAM-A:
    [reader]
    label = OSCAM-B-CACHE
    protocol = cccam
    device = oscamserverB.com,12000
    user = OSCAM-A-CACHE
    password = password
    cacheex = 1 # or 2/3
    group = 1


    oscam.user on OSCAM-B:


    [account]
    user = OSCAM-A-CACHE
    pwd = password
    group = 1
    cacheex = 1 # or 2/3
    cccmaxhops = -1


    oscam.reader on OSCAM-B:


    [reader]
    label = OSCAM-A-CACHE
    protocol = cccam
    device = oscamserverA.com,12000
    user = OSCAM-B-CACHE
    password = password
    cacheex = 1 # or 2/3
    group = 1


    oscam.user on OSCAM-A:


    [account]
    user = OSCAM-B-CACHE
    pwd = password
    group = 1
    cacheex = 1 # or 2/3
    cccmaxhops = -1



    Groups and filtering
    Cache streams can be filtered on all parameters that are normally used for normal sharing.
    Entering a specific CAID or IDENT into a user or reader config will filter the transfer / reception of the cache.


    Also groups can be used, but since cache is 'free', i would recommend putting all utilized groups in all cacheEX users and readers.



    Frequently asked questions



    I have configured a cacheEX connection with cc-cam protocol, but see "NEEDINIT (0 of 0 cards)" in the status screen.
    This is normal / secure behaviour, since you set 'cccmaxhops = -1' in the userconfig to hide your cards. Ignore this warning, and check your CACHE-EX tab for status on incoming/transmitted cache.




    Logging and monitoring
    The efficiency of your cache can be measured with the totals displayed on the bottom of Oscam's Users page in the GUI.


    My server currently reports:
    Total
    Disabled Expired Active Connected Online OK NOK
    IGN TOUT
    CACHE
    TUN
    Action
    50
    1 0 46
    36
    11 29513 0
    0 0
    24140 0



    Meaning.. almost almost 50% of all my request are flowing from cache.


    Also, you can check an overview of the cache thru the WEB GUI -> http://<oscamserverURL>/cacheex.html

  • i use oscam from yesterday i got to configure my cccam in oscam i use cachex but collapse my dreambox8000 any idea which is the best configuration to use cccam in iscam?


    im new on this emu

OSCam Support Forum

Configs, discussion, downloads and guides for OSCam Softcam.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!