B4J Question [ABMaterial] Too many 'waiting for value' messages

amminf

Active Member
Licensed User
Longtime User
Updating to v2.17, in new ABMaterial version, now I obtain too many waiting for value messages in log console y log file y very slow in Page.refresh in release mode (hosted)
Perhaps it seems slow webapp.




BTW. In addtion a tip: srvr.DebugNetworkLatency = 0 is neccesary in B4J (debug and release mode)
Edited: This assert is wrong.
 
Last edited:

amminf

Active Member
Licensed User
Longtime User
Times on load a table in release mode: (too much)
In debug mode is more fast.
Just after Page.Refresh, webapp writes to log:

Waiting for value (170 ms)
Waiting for value (159 ms)
Waiting for value (99 ms)
Waiting for value (139 ms)
Waiting for value (102 ms)
Waiting for value (115 ms)
Waiting for value (127 ms)
Waiting for value (104 ms)
Waiting for value (115 ms)
Waiting for value (115 ms)
Waiting for value (103 ms)
Waiting for value (115 ms)
Waiting for value (103 ms)
Waiting for value (114 ms)
Waiting for value (106 ms)
Waiting for value (106 ms)
Waiting for value (102 ms)
Waiting for value (103 ms)
Waiting for value (99 ms)
Waiting for value (101 ms)
Waiting for value (99 ms)
Waiting for value (107 ms)
Waiting for value (103 ms)
Waiting for value (109 ms)
Waiting for value (106 ms)
Waiting for value (108 ms)
Waiting for value (104 ms)
Waiting for value (115 ms)
Waiting for value (116 ms)
Waiting for value (116 ms)
Waiting for value (104 ms)
Waiting for value (113 ms)
Waiting for value (114 ms)
Waiting for value (116 ms)
Waiting for value (107 ms)
Waiting for value (104 ms)
Waiting for value (114 ms)
Waiting for value (116 ms)
Waiting for value (114 ms)
Waiting for value (155 ms)
Waiting for value (99 ms)
Waiting for value (102 ms)
Waiting for value (99 ms)
Waiting for value (291 ms)
Waiting for value (99 ms)
Waiting for value (101 ms)
Waiting for value (99 ms)
Waiting for value (110 ms)
Waiting for value (100 ms)
Waiting for value (102 ms)
Waiting for value (99 ms)
Waiting for value (131 ms)
Waiting for value (99 ms)
Waiting for value (101 ms)
Waiting for value (99 ms)
 
Last edited:
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Check in your code of you are not doing to many .refresh's. For example don't do a modal refresh before opening it (ABM will do this for you) else it will happen double. Tables may cause more if they contain abmcomponents, but this is absolutely needed for stability.

Can you show me the code of connectpage where you use this table?

Debug and release should act the same.

srvr.DebugNetworkLatency = 0
don't do that. You are only fooling yourself. This was build in by Erel to simulatie real life behaviour of your webapp In debug mode. In release mode this is always 0.
 
Upvote 0

amminf

Active Member
Licensed User
Longtime User

Solved ! Commenting Page.Refresh done the work. Thks.

B4X:
public Sub ConnectPage()
'  connecting the navigation bar        

'  init all your own variables (like a List, Map) and add your components
    #Region comun_todas_paginas_3           ' comun_todas_paginas
       Log("antes refresbartitlepage")
       ABMShared.RefreshBarTitlePage(page)
    #end region

   Log("antes del refresh")
   ' refresh the page
   'page.Refresh   ' <<-- Comment this line done the work.
 
   Log("antes del finishloading")
   ' Tell the browser we finished loading
   page.FinishedLoading
 
   ' restoring the navigation bar position
   page.RestoreNavigationBarPosition 'used to be in the depreciated Page_Ready() event!
End Sub

don't do that. You are only fooling yourself. This was build in by Erel to simulatie real life behaviour of your webapp In debug mode. In release mode this is always 0.
Ok !




All it's right.

It's seems updating to ABMaterial v2.17 from v1.20 is already ok.
 
Upvote 0

stanmiller

Active Member
Licensed User
Longtime User
Updating to v2.17, in new ABMaterial version, now I obtain too many waiting for value messages in log console

I agree. We have a simple calculator and B4J's jServer ABM 2.17 outputs three (3) messages with each [CALCULATE] button press.



Here's the click event.
B4X:
'*--------------------------------------------------------------- btn_Clicked
'*
Sub btn_Clicked(Target As String)

    Private const NO_GROUPING=False As Boolean
    Private sLength As ABMInput = page.Component("inp1")
    Private sWidth As ABMInput = page.Component("inp2" )
    Private sDepth As ABMInput = page.Component("inp3")
    Private nProductTons As Double
    Private amount As ABMLabel = page.Component("lblamt")

    nProductTons = Calc.ProductTons( sLength.Text, sWidth.Text, sDepth.Text, 1 )
    amount.Text = "{NBSP}" & NumberFormat2( nProductTons, 1, 1, 1, NO_GROUPING ) & "{NBSP} (Tons)"

    amount.Refresh

End Sub

It gives the feel that this is a debug version of the library. Granted a library may have debug tracing built in but this would normally be configurable. And perhaps by degree (debug level 1, 2, and so on...)

Attached is a simple logger we use in our projects (feel free to edit/improve and use).

Debug logging is integrated into all our apps for both release and production builds. When apps are released in the wild there are always little surprises that weren't accounted for during design. That's when you enable the debug logging to help sort things out.

In our release builds debugging is disabled by default. If we get in a fix, we can remotely turn it on:

Mtelog.DebugOn( True )

Then all calls to Mtelog.Debug ("Greetings from the debug log!") are output.

This "Waiting for value" metric is valuable info. But in a release build this could be tested against a threshold (possibly configurable) that when exceeded it would generate a warning.

If ( waittime > 100 ) Then
Mtelog.Warning( "Wait for value exceeds 100 ms, waittime=" & waittime )
End If

** Update **
The waiting message output can be toggled on/off through a jServer option.
B4X:
Public srvr As Server
srvr.Initialize("srvr")
srvr.LogWaitingMessages = False
 

Attachments

  • Mtelog.bas
    11.9 KB · Views: 212
Last edited:
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
this 'waiting for value' message is not controlled nor generated by ABMaterial. It is the default B4J behaviour when a B4J SimpleFuture is used. It is a very delicate balance to optimize it
Maybe there is a way of turning it off in B4J but that is something I'm not aware of.
three (3)
BTW, I can read numerals both in text and numeric version, so no need to write them both

It gives the feel that this is a debug version of the library.
And this will stay this way. Debugs are in there for me to find out where something may go wrong.
 
Upvote 0

stanmiller

Active Member
Licensed User
Longtime User
BTW, I can read numerals both in text and numeric version, so no need to write them both

Numbers in Parentheses
http://www.quickanddirtytips.com/education/grammar/numbers-in-parentheses

Oh my! In documents Dad always wrote numbers that way and I never knew why... until now.

This one is funny.

Why do people (people) put numbers ( numbers) in parentheses?
http://thelawlers.com/Blognosticator/?p=810

I would go back and edit my transgression but that would blow up your quote.
 
Upvote 0

stanmiller

Active Member
Licensed User
Longtime User

I see it now. It's configurable.
B4X:
    srvr.Start
    Dim jo As JavaObject = srvr
    '--------------------------------------------------------- Disable waiting messages
    srvr.LogWaitingMessages = False

    Dim connectors() As Object = jo.GetFieldJO("server").RunMethod("getConnectors", Null)
    Dim timeout As Long = ABMShared.SessionMaxInactiveIntervalSeconds*1000
    For Each c As JavaObject In connectors
        c.RunMethod("setIdleTimeout", Array(timeout))
    Next
    ABMShared.CachedPages = srvr.CreateThreadSafeMap

A better approach for ABM developers may be to keep them on, redirect to a private stream (similar to ABMShared.RedirectOutput), monitor and filter, then output the scrubbed messaging to a file.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…