[ 
https://issues.apache.org/jira/browse/BEAM-13001?focusedWorklogId=666588&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-666588
 ]

ASF GitHub Bot logged work on BEAM-13001:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 18/Oct/21 23:06
            Start Date: 18/Oct/21 23:06
    Worklog Time Spent: 10m 
      Work Description: riteshghorse commented on a change in pull request 
#15657:
URL: https://github.com/apache/beam/pull/15657#discussion_r731375722



##########
File path: sdks/go/pkg/beam/core/metrics/store.go
##########
@@ -174,36 +174,35 @@ type executionTracker struct {
        numberOfTransitions       int64
        millisSinceLastTransition time.Duration
        transitionsAtLastSample   int64
-}
-
-// executionState is used to store as atomic.Value in Store.
-type pTransformState struct {
-       pid   string
-       state bundleProcState
-}
-
-func newPTransformState(pid string, state bundleProcState) *pTransformState {
-       return &pTransformState{pid: pid, state: state}
+       currentState              bundleProcState
+       pid                       string
 }
 
 func SetPTransformState(ctx context.Context, state bundleProcState) {
        if bctx, ok := ctx.(*beamCtx); ok {
-               ps := newPTransformState(bctx.ptransformID, state)
-               bctx.pStore.Store(ps)
-               atomic.AddInt64(&bctx.transitions, 1)
+               pid := bctx.ptransformID
+               bctx.store.mu.Lock()
+               bctx.store.executionStore.pid = pid
+               bctx.store.executionStore.currentState = state
+               bctx.store.mu.Unlock()
+               atomic.AddInt64(&bctx.store.executionStore.numberOfTransitions, 
1)

Review comment:
       `allocs/op` changed significantly (from 2 to 12) when I used 
atomic.Value to store and load BundleState into it. Also, the time per loop 
changed from 2566 ns/op to 3376 ns/op.
   
    Did this benchmarking without pprof. Now I'll do it with pprof.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 666588)
    Time Spent: 3h 10m  (was: 3h)

> DoFn Execution time metrics (msecs) for Go SDK
> ----------------------------------------------
>
>                 Key: BEAM-13001
>                 URL: https://issues.apache.org/jira/browse/BEAM-13001
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-go
>            Reporter: Ritesh Ghorse
>            Assignee: Ritesh Ghorse
>            Priority: P2
>          Time Spent: 3h 10m
>  Remaining Estimate: 0h
>
> Implement DoFn execution time metrics for Go SDK. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to