Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable length struct support in FASTER C# #120

Merged
merged 36 commits into from
Apr 23, 2019
Merged

Variable length struct support in FASTER C# #120

merged 36 commits into from
Apr 23, 2019

Conversation

badrishc
Copy link
Contributor

@badrishc badrishc commented Apr 18, 2019

The title appears contradictory, but bear with us for a minute.

We are (re-)introducing an unsafe advanced use case for FASTER, where there is a need to
store and index variable length keys and/or values in the hybrid log, without using classes
or a separate object log.

The basic idea is to use ref struct as a proxy for pointers to variable-sized memory in
C#. These objects are placed contiguously in-place in the single hybrid log, leading to
efficient packing while avoiding the additional I/O (on reads and writes) that a separate
object log entails. Users have to be careful that updates do not attempt to increase the
size of the object, if the object is already present in the mutable region.

Users provide information on the actual length of the data underlying the types, by
providing implementations for an IVariableLengthStruct<T> interface. Serializers are not
required, as these are effectively value-types.

This interface to FASTER is unsafe -- one may orthogonally create safe APIs on top of this
raw functionality using, for example, Span<T> and Memory<T>.

See an example of how this functionality is used here: https://github.com/Microsoft/FASTER/tree/master/cs/playground/VarLenStructSample

badrishc and others added 30 commits April 2, 2019 16:10
…l.values for threads that haven't initialized values yet
commit 2ba964526c96c5c6852d1b702348a5bc9fa94dcb
Merge: f2b2c1f 765c083
Author: Badrish Chandramouli <badrishc@microsoft.com>
Date:   Thu Apr 4 10:54:51 2019 -0700

    Merge branch 'nostatics' of https://github.com/Microsoft/FASTER into readobjfix

commit f2b2c1f84b0bac97da222de4f3c929743742ecf2
Author: Badrish Chandramouli <badrishc@microsoft.com>
Date:   Thu Apr 4 10:54:09 2019 -0700

    Fixes to addresses, cleanup object read logic

commit 765c083
Author: Peter Freiling <peterfr@microsoft.com>
Date:   Thu Apr 4 10:01:26 2019 -0700

    Fixing issue where LightEpoch.IsProtected dereferences FastThreadLocal.values for threads that haven't initialized values yet

commit b78aee3
Author: Peter Freiling <peterfr@microsoft.com>
Date:   Wed Apr 3 20:43:28 2019 -0700

    Removing extra buffer copy

commit cd0da5ec37469486e0b6cd978c2088a5ee6bb598
Author: Badrish Chandramouli <badrishc@microsoft.com>
Date:   Wed Apr 3 19:59:53 2019 -0700

    Updates

commit 8d2ceeb6afcdaf2dacb98c0fa905a66bba7f3ae9
Author: Badrish Chandramouli <badrishc@microsoft.com>
Date:   Wed Apr 3 19:22:39 2019 -0700

    Fix for reading objects
@badrishc badrishc merged commit a06ad6a into master Apr 23, 2019
@badrishc badrishc deleted the varlenstructs branch April 23, 2019 19:03
@watkinsm
Copy link

@badrishc: I hope you found the impact report helpful! I came across FASTER and requested the report just out of curiosity, but if you're interested we can set up @softagram-bot to analyze all of your open source pull requests for free. On your end it would just require setting up a webhook, and we'll take care of the rest. Let me know 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants