How to get Hogging Thread name WLST - multithreading

I want to get names of thread marked as Hogger in weblogic.
I have tried with
ThreadPoolRuntimeMBean.getHoggingThreadCount()
but this gives only count of hogging threads.
Under Self- Tuning Thread Pool Threads
Weblogic is displaying "Thread Name" ,"Stuck" (True/ false) and "Hogger" (True/ false) , So obviously weblogic developer has written some method to get these values.
I am looking for that weblogic inbuilt method (in WLST) or any other way to get names of hogging threads.
PFA Weblogic Screen Shot for more detail
or check image on this link (http://www.munzandmore.com/wp-content/uploads/2012/04/st9.jpg)

Here is a very basic WLST script to accomplish this (for a default non-clustered AdminServer installation):
connect('weblogic', 'welcome1')
serverRuntime()
cd('ThreadPoolRuntime/ThreadPoolRuntime')
for thread in cmo.getExecuteThreads():
print(thread.getName() + " - " + str(thread.isHogger()))
You can use print dir(thread) to get all the available properties and methods.
For a more complex managed server environment, you can combine the above with this example: http://wlstbyexamples.blogspot.co.za/2009/06/self-tuned-thread-pool-count.html#.ViCqTnVStBc

Related

What does the name between [] printed using log interface of org.apache.commons.logging mean in a grails app?

I am trying to debug a problem in a grails application and I see in log:
[http-nio-8180-exec-19] ERROR org.hibernate.internal.SessionImpl - HHH000346: Error during managed flush [Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1]. I want to know what http-nio-8180-exec-19 stands for and if I can use this thread name to track what user did the operation that lead to the exception.
Can I assume that on thread http-nio-8180-exec-19 I will see all the operations done by just an user and each user that will log into the application will have a different thread associated?
By default I believe those are the names of threads, though you could put whatever you want there. If you have something like [%15.15t] in your logback.groovy, that is what is causing the thread name to be inserted there.

Jmeter ${__setProperty()} Not working across multiple threads in the same thread group

I am trying to do setproperty across multiple threads in the same threadgroup, the postprocessor set new variable using setproperty, so that It can be accessed across multiple threads.
In Beanshell preprocessor, I'm having below line of code.
${__setProperty("url", "youtube")};
Under thread Group I'm having Beanshell post processor, having below one line in postprocessor.
${__setProperty("url", "google")};
under thread group, I have Http Sampler, in hostname field I have given ${__property(url)}.com
The Aim is, when it executes first time, the URL will be google.com and when first threads complete than
the URL becomes youtube.com
But the setProperty only set google, and the second one in postprocessor was not working.
Refer the below Image for details, it shows how I created the element in Jmeter.
enter image description here
Note: This was just a sample use case, but I have complex example, but answering to this question will help me to add the logic in complex script.
Thanks
So is the goal that the very first thread to complete will change the URL for all subsequently created threads?
My understanding of the documentation is that you can't change the value of a property inside the thread-group:
Properties can be referenced in test plans - see Functions - read a property - but cannot be used for thread-specific values.
(see http://jmeter.apache.org/usermanual/test_plan.html#properties)
My assumption is that each thread in a thread-group gets a copy of the properties. If you change the value of the property inside the thread group, then you are actually changing the copy for that particular thread. Since you are changing it in the post-processor, the thread is very likely just about to be disposed, resulting in your change being lost. After disposal a new thread is created but with the original value of the property.
So what you need to do is figure out how to change the value outside of the thread-group.
I have done something similar in my own tests whereby I am changing the value of a property in the middle of the test, and the value is picked up immediately by all of the active thread-groups, resulting in each new thread created from that point forward getting the new value. I am doing this by using the Beanshell Server: https://jmeter.apache.org/usermanual/best-practices.html#beanshell_server
In my specific case I use jenkins job that calls a shell-script which connects to the beanshell-service running on the local-host:
java -jar ${jmeter_home}/apache-jmeter-5.0/lib/bshclient.jar localhost 9000 ${test_plan_home}/update_Prop.bsh "${property}" "${value}"
where my update_prop.bash file is simply:
import org.apache.jmeter.util.JMeterUtils;
JMeterUtils.getJMeterProperties().setProperty(args[0],args[1]);
You would not need to use Jenkins or anything like that, though - if you setup your JMeter Process to include the Beanshell-server (see the link above) then you can simply replace the code in your post-processor:
${__setProperty("url", "google")};
with the code to connect to the beanshell server and execute that command there instead:
exec("./updateprop.bash url google");
JMeter properties are global therefore once you set the property it is available for all threads
Each JMeter thread (virtual user) executes Samplers. Pre and Post processors are obeying JMeter Scoping Rules Looking into your test plan the execution order is following:
Beanshell PreProcessor
HTTP Request Sampler
Beanshell PostProcessor
therefore HTTP Request sampler will never hit youtube (unless you run into a race condition due to concurrency) because PreProcessor will set the URL back to google
It is recommended to use JSR223 Test Elements and Groovy language for scripting since JMeter 3.1
It is NOT recommended to inline JMeter Functions and/or variables into scripts, you need to either use "Parameters" section or go for code-based equivalents instead so you need to replace this line:
${__setProperty("url", "youtube")};
with this one:
props.put("url", "youtube");

Two independent flows (processes) in Django-Viewflow under one frontend, exception raised

I'm trying to implement two identical independent Processes (flows) under one frontend. After fresh migration I can start one of them (as many times as I like) and it works fine. But when I try to start another one it raises DoesNotExist exception ("Process(Х) matching query does not exist"). After this it's not possible to start neither of them. It looks like when next node is been initialized (after start) the process object can't be found.
Update:
I tried adding my app to viewflow demo. My processes is OK only when started first. Starting it after any demo processes (helloworld etc.) raises the exception. All demo processes start smoothly anytime.
The difference makes that my process model has simple custom primary key:
class Order(Process):
order_no = models.AutoField(primary_key=True)
...
When I tried commenting the custom key out the problem went away.
Since it's Multi-table inheritance, OneToOneField field should be used if a custom field is needed:
class Order(Process):
process_ptr = models.OneToOneField(
Process, on_delete=models.CASCADE,
parent_link=True,
)
...

Implementing Multithreading in Oracle Procedures

I am working on Oracle 10gR2.
And here is my problem -
I have a procedure, lets call it *proc_parent* (inside a package) which is supposed to call another procedure, lets call it *user_creation*. I have to call *user_creation* inside a loop, which is reading some columns from a table - and these column values are passed as parameters to the *user_creation* procedure.
The code is like this:
FOR i IN (SELECT community_id,
password,
username
FROM customer
WHERE community_id IS NOT NULL
AND created_by = 'SRC_GLOB'
)
LOOP
user_creation (i.community_id,i.password,i.username);
END LOOP;
COMMIT;
user_Creation procedure is invoking a web service for some business logic, and then based on the response updates a table.
I need to find a way by which I can use multi-threading here, so that I can run multiple instances of this procedure to speed up things. I know I can use *DBMS_SCHEDULER* and probably *DBMS_ALERT* but I am not able to figure out, how to use them inside a loop.
Can someone guide me in the right direction?
Thanks,
Ankur
what you can do is submit lots of jobs in the same time. See Example 28-2 Creating a Set of Lightweight Jobs in a Single Transaction
This fills a pl/sql table with all jobs you want to submit in one tx, all at the same time. As soon as they are submitted (enabled) they will start running, as many as the system can handle, or as many as are allowed by a resource manager plan.
The overhead that the Lightweight jobs have is very ... minimal/light.
I would like to close this question. DBMS_SCHEDULER as well as DBMS_JOB (though DBMS_SCHEDULER is preferred) can be used inside the loop to submit and execute the job.
For instance, here's a sample code, using DBMS_JOB which can be invoked inside a loop:
...
FOR i IN (SELECT community_id,
password,
username
FROM customer
WHERE community_id IS NOT NULL
AND created_by = 'SRC_GLOB'
)
LOOP
DBMS_JOB.SUBMIT(JOB => jobnum,
WHAT => 'BEGIN user_creation (i.community_id,i.password,i.username); END;'
COMMIT;
END LOOP;
Using a commit after SUBMIT will kick off the job (and hence the procedure) in parallel.

A unique ID per User / Session in logs on all levels? Log4J?

Well we are doing some performance testing to figure out what steps of our application take how much time. Of course easy to parse / filter logs with regexp are a charm.
To the problem: Our jsf application is split into several projects, which are used by other (non jsf) applications.
My first approach would have been:
if(logger.isDebugEnabled())
logger.debug("Service call took: " + (System.currentTimeMillis() - time)+ " JSESSIONID="+CookieUtil.getJsessionId(FacesContext.getCurrentInstance())) ;
(CookieUtil would read the sessionId from the HttpServletRequest)
But... obviously other projects don't like dependencies to JSF libraries, nor to my neat CookieUtil.
Does log4j provide something?
Is there another tool / concept for this?
You could accomplish what you are looking for w/ log4j MDC:
Log4j MDC
and using a Servlet Filter similar to this example:
MDCServletFilter

Resources