View · Index

Weblog

Filtered by popular tag libthread, 1 - 3 of 3 Postings (all, summary)

Tcl Thread Library

Created by Gustaf Neumann, last modified by Gustaf Neumann 25 Sep 2019, at 11:40 AM

Libthread is the standard Tcl thread library developed by Zoran Vasiljevic and provides optional functionality for OpenACS. Threads created by the Tcl thread library are executed in an event loop, which makes it easy to send commands to such threads. xotcl-core provides support for the the thread library and uses it for example for background delivery of large files. Also the chat package uses libthread when it is installed. The xotcl-request-monitor depends on libthread.

The advantage of libthead over NaviServer/AOLserver threads is that the threads created by libthread are waiting in an event loop for incoming requests, which eases some types of applications.

INSTALLATION:

In case, NaviServer was installed via install-ns, one can skip the section installation steps. Also the provided configuration script is already set up correctly for usage. The instruction below is for cases, where install-ns was not used.

1. Get and install libthread:

    download libthread e.g. from

  https://downloads.sourceforge.net/sourceforge/tcl/thread2.8.2.tar.gz

   untar it and go to you platform specific directory (eg. thread2.8.2/unix)

    # cd unix
    # ../configure --enable-threads \
      --prefix=/usr/local/ns \
      --exec-prefix=/usr/local/ns \
      --with-naviserver=/usr/local/ns

use --prefix --exec-prefix --with-naviserver with the path pointing to the directory, where NaviServer is installed.
The setup for AOLserver is similar, but different paths are used.

  make
  make install

You should now have installed libthread2.8.2.so (check for /usr/local/ns/lib/thread*/libthread* )

2) Adjusting the AOLserver/NaviServer configuration file to use libthread

    Open the configuration file 

  • look for modules section: ns_section ns/server/${server}/modules
  • add libthread to modules section:
    ns_param libthread thread2.8.2/libthread2.8.2.so

restart nsd and check the error log, whether libthread was loaded successfully.

Boost your application performance to serve large files!

Created by Rocael Hernández Rizzardini, last modified by Gustaf Neumann 16 Oct 2016, at 12:38 PM

In order to speed up file-deliveries, one can use the background delivery methods provided by xotcl-core. The main advantage is that with background delivery the costly connection threads are just used for permission checking and locating the file, and the time-consuming spooling of the file to the client is implemented in an asynchronous background delivery thread. Therefore, connection thread are not blocked, it is possible to spool simultaneously several hundred (thousand?) files with only a few connection threads configured.

We use this in production since several years. For example today (no semester yet) we had so far 150.000 file deliveries by background delivery.

The asynchrounous background delivery requires a small patch (2 changes, one is a backport from naviserver) and the tcl thread library (by zoran). The application code is in XOTcl is only a few lines of code and is included in xotcl-core (bgdelivery-procs.tcl).

One needs the following patch to

The patch is already included in the current head version of aolserver 4.5 and in NaviServer.

With this patch and xotcl-core, one can replace
   ns_returnfile 200 $mime_type $filename

by
   ad_returnfile_background 200 $mime_type $filename

e.g. in cr_write_content in acs-content-repository/tcl/revision-procs.tcl to activate it and to deliver files from the content-repository (file-store) in the background.

The connection thread is only used for permission management, localization of the file and writing the the reply header, the actual delivery of the file is performed via asynchronous io without using up many resources. This can handle probably a couple of thousand concurrent file deliveries without running out of resources.

Check the files that has been served since the last reboot of your NaviServer/aolserver using this method from the developer support shell:

   bgdelivery do set delivery_count


Original thread:
https://openacs.org/forums/message-view?message_id=482221

 

 

XOTcl Request Monitor

Created by Gustaf Neumann, last modified by Gustaf Neumann 12 Apr 2016, at 10:35 AM

 

Package Specification Summary for Package: xotcl-request-monitor

Summary: Request Monitor with user tracking functionality
Description: <pre> This package provides a Request Monitor for OpenACS applications. It computes performance summary information such as requests/views per second, average response time, number of users connected, lists currently active threads, etc. Furthermore, it can block overactive users (e.g. automated web-bots mirroring the site, users repeating running queries, etc.). It provides as well some user tracking (such as whos-online) with activity measures, it blocks repeated requests (impatient reloads), tracks switching of IP addresses from users, and provides request tracking per user for the monitored time window. It contains as well overall URL statistics with performance measures. Updated for circumventing handler calls OpenACS 5.2 for /resources/*. 0.28 provides calls for listing active communities and users active in these communities. 0.30 provides nice graphical charts (many thanks to Nima) and a new interface to the background thread. In addition, ns_returnfile_background is included; 0.38 using context form xotcl-core 0.39 brings parameterized counter values 0.39 brings optional activity tracking </pre>
Maturity: Mature
This package depends on: acs-kernel acs-tcl xotcl-core acs-templating
Packages that depend on xotcl-request-monitor: None
Package parameters:
do_double_click_prevention
Switch double-click-prevention on/off (default on, type string, scope instance)
do_slowdown_overactive
Slowdown overactive users (default off) (default off, type string, scope instance)
do_throttle
Turn request throttling on or off (default on). If this parameter is turned off, no user-counts etc are provided. (default on, type string, scope instance)
do_track_activity
Turn activity monitoring on or off (default off) (default off, type string, scope instance)
hide-requests
List of glob patterns to be used for hiding entries from request lists. Only requests that do not match any of these patterns are displayed unless all requests are forced. Affected pages: - stat-details (list of all recorded URLs with timings) - last-requests (tracking activity of a user) (default *.css *.ico, type string, scope instance)
max-stats-elements
Number of highest data points in the reporting period. The default of 5 will e.g. show you the top 5 times of requests per minute, hour aso. (default 5, type number, scope instance)
max-url-stats
Number of URL entries to be kept in the detailed view of the request statistics (default 100, type number, scope instance)
monitor_urls
Monitor performance of the provided URLs (in munin responsetime) (default / /register/ /dotlrn/, type string, scope instance)
peer-groups
List of glob patterns for the summary of sites when an admin uses .../whos-online/. These patterns are matched against the domain names of the peer addresses. (default *wlan* *dsl* *.com *.net *.org, type string, scope instance)
time-window
Defines the time window in minutes which is used for detailed monitoring (e.g. calculate the number of active uses and the history of the requests of these users, the number of ip switches, etc.) (default 10, type number, scope instance)
trend-elements
Number of data points used for displaying the trend graphs. The default will show the trend for the last 48 seconds,minutes,hours. It is also the maximum reporting period possible (default 48, type number, scope instance)

Bug Tracker Summary for Package: xotcl-request-monitor

Open Bugs: 0
All Tracked Issues: 2
Latest Bug Opened: This package has no open bugs.
Latest Bug Fixed: 2015-06-26 Russian localization for package xotcl request monitor (HEAD).
Top Bug Submitters: Malte Sussdorff (1) Vlad V (1)
Top Bug Fixers: Gustaf Neumann (2)

Code Metrics Summary for Package: xotcl-request-monitor

# Tcl Procs 7
# Tcl Lines 2273
# Tcl Blank Lines 205
# Tcl Comment Lines 540
# Automated Tests 1
# Stored Procedures PG: 0 ORA: 0
# SQL Lines PG: 0 (blank 1 comments 0) ORA: 0 (blank 1 comments 0)
# ADP pages 17
# ADP lines 449
# Include pages (xotcl-request-monitor/lib/) 0
# Documentation pages 0
# Documentation lines 0
Browse Source API-browser
Github Repository: https://github.com/openacs/xotcl-request-monitor/tree/oacs-5-10
 

The xotcl--request-monitor depends on xotcl-core and libthread.

previous March 2024
Sun Mon Tue Wed Thu Fri Sat
25 26 27 28 29 1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31 1 2 3 4 5 6

Popular tags

17 , 5.10 , 5.10.0 , 5.9.0 , 5.9.1 , ad_form , ADP , ajax , aolserver , asynchronous , bgdelivery , bootstrap , bugtracker , CentOS , COMET , compatibility , CSP , CSRF , cvs , debian , docker , docker-compose , emacs , engineering-standards , exec , fedora , FreeBSD , guidelines , host-node-map , hstore
No registered users in community xowiki
in last 30 minutes
Contributors

OpenACS.org