<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:52:51 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Whamcloud Community JIRA</title>
    <link>https://jira.whamcloud.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.14</version>
        <build-number>940014</build-number>
        <build-date>05-12-2023</build-date>
    </build-info>


<item>
            <title>[LU-12468] Add writeahead state tracking</title>
                <link>https://jira.whamcloud.com/browse/LU-12468</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;This ticket is to add write state tracking to the current read state tracking used for writeahead.&#160; It is called &quot;writeahead state tracking&quot;, and attempts to predict future writes based on past writes.&#160; Because it does not need to deal with a variable size window (where we sometimes read part of the window due to readahead limits), it can be massively simpler than the readahead code.&lt;/p&gt;

&lt;p&gt;The eventual goal of this is to recognize strided patterns, and in combination with the server reporting lock contention back to the client, do automatic lockahead.&lt;/p&gt;

&lt;p&gt;This is also being done to help start a conversation while we (mostly &lt;a href=&quot;https://jira.whamcloud.com/secure/ViewProfile.jspa?name=wshilong&quot; class=&quot;user-hover&quot; rel=&quot;wshilong&quot;&gt;wshilong&lt;/a&gt; &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.whamcloud.com/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&#160;) are considering how to update/improve the readahead code.&#160; It maybe possible to share some code, or at least an approach.&lt;/p&gt;</description>
                <environment></environment>
        <key id="56080">LU-12468</key>
            <summary>Add writeahead state tracking</summary>
                <type id="4" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11310&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.whamcloud.com/images/icons/priorities/minor.svg">Minor</priority>
                        <status id="1" iconUrl="https://jira.whamcloud.com/images/icons/statuses/open.png" description="The issue is open and ready for the assignee to start work on it.">Open</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="paf0186">Patrick Farrell</assignee>
                                    <reporter username="pfarrell">Patrick Farrell</reporter>
                        <labels>
                            <label>performance</label>
                    </labels>
                <created>Mon, 24 Jun 2019 16:50:20 +0000</created>
                <updated>Fri, 9 Jul 2021 19:55:35 +0000</updated>
                                                                                <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                            <comments>
                            <comment id="249797" author="pfarrell" created="Mon, 24 Jun 2019 16:52:48 +0000"  >&lt;p&gt;&lt;a href=&quot;https://review.whamcloud.com/35286&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/35286&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="250404" author="wshilong" created="Mon, 1 Jul 2019 07:02:56 +0000"  >&lt;p&gt;Patrick,&lt;/p&gt;

&lt;p&gt;   I though that for lockahead purpose, we need not only detect gap, but also exact consecutive write bytes, the exact consecutive write bytes shall be where we should grab lock, and gap is area where lock should be invalidated.&lt;/p&gt;
</comment>
                            <comment id="250421" author="pfarrell" created="Mon, 1 Jul 2019 14:34:38 +0000"  >&lt;p&gt;Hmm, so lockahead is just going to request new locks.&#160; It&apos;s probably best to explain how I plan for that patch to work...&lt;/p&gt;

&lt;p&gt;The idea is this.&lt;/p&gt;

&lt;p&gt;The client is detecting the write pattern, using this patch.&lt;/p&gt;

&lt;p&gt;The server detects lock contention (Patch for that soon, but the definition of contention I use is &quot;most lock requests have to cancel another lock&quot;. It&apos;s different than the existing code), and reports this to the client. (Not by returning -EUSERS and not giving a lock as in the existing code. Instead, it just sets a flag on the lock it returns.)&lt;/p&gt;

&lt;p&gt;The client notices there is contention on a file (It is passed up from the LDLM resource to the llite level). If the client is not writing in strided, it doesn&apos;t do anything. If the client is writing in strided, it does the following:&lt;br/&gt;
1. Sets &quot;no expand&quot; on the file&lt;br/&gt;
2. Requests the next few locks it expects to need, and notes that it did this. There is a window for how many locks to request.&lt;br/&gt;
3. At the start of each write, track how many locks we&apos;ve used and request more a little before we expect to need them (This assumes we are still doing strided writing)&lt;/p&gt;

&lt;p&gt;&quot;No expand&quot; is for the case where lockahead lock is not present for a write. The client will send a lock request for the i/o to the server. No expand means the server will not expand that request - This is necessary because otherwise the expanded lock would block lockahead requests.&lt;/p&gt;

&lt;p&gt;It&apos;s important to remember that lockahead lock requests are asynchronous and non-blocking (a lock request cannot be async and blocking due to LDLM internals). This means that when we request lockahead locks, if there is an existing lock, they will be blocked by it.&lt;/p&gt;

&lt;p&gt;So the expectation for how this works is this:&lt;/p&gt;

&lt;p&gt;Several clients are writing to a stripe, in strided mode. They are getting large locks, one at a time, and exchanging them back and forth.&lt;/p&gt;

&lt;p&gt;The server reports contention. Some clients notice before others.&lt;/p&gt;

&lt;p&gt;The clients which notice go in to lockahead mode. Often, their first few lock requests will be blocked by a client that is not in lockahead mode yet. But fairly quickly, all of the clients receive the contention notice, and all begin doing lockahead. If there is an existing lock when this starts, the first few lockahead requests are lost, but then that lock is cancelled by the &apos;normal&apos; lock request done as part of an i/o (this is an i/o that wanted to use a lockahead lock, but the lockahead request failed so it does not). This request is &quot;no expand&quot;, so it cancels the existing &quot;big&quot; lock, but is not expanded, clearing the file for future lockahead requests.&lt;/p&gt;

&lt;p&gt;So when contention is first detected, there is a moment where the clients switch to the lockahead pattern and some requests are wasted, but very quickly they settle in to the new pattern. (Note that this means the server will no longer report contention. This is OK - The client does not care, it will continue to do lockahead as long as it detects the strided pattern. If the server stops reporting contention &lt;b&gt;before&lt;/b&gt; one client talks to it, so one client does not switch to lockahead mode, that client will &lt;b&gt;cause&lt;/b&gt; contention and so will also switch. &lt;span class=&quot;error&quot;&gt;&amp;#91;blocked lockahead requests count towards &amp;#39;contention&amp;#39;&amp;#93;&lt;/span&gt;)&lt;/p&gt;

&lt;p&gt;Giving the client control over what to do lets the client pick a good optimization when contention occurs. In the case of totally random i/o, the client might want to switch to lockless - once it&apos;s fixed - but the point is the &lt;b&gt;client&lt;/b&gt; has the required information to do that.&lt;/p&gt;


&lt;p&gt;So to your question:&lt;br/&gt;
Lockahead is just going to ask for locks where the client &lt;b&gt;plans&lt;/b&gt; to write. It will not do anything to the gaps. Other clients will be responsible for those. Does that make sense? (It would be nice to do blocking async requests, but the LDLM problem that prevents this is very tricky.)&lt;/p&gt;</comment>
                            <comment id="250597" author="wshilong" created="Wed, 3 Jul 2019 11:19:06 +0000"  >&lt;p&gt;This makes a lot of sense to me, thanks for very much detailed explain!&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="56411">LU-12550</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                            <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i00inb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>