View · Index

Weblog

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

Chat

Created by Emmanuelle Raffenne, last modified by Gustaf Neumann 24 Nov 2023, at 06:41 PM

Package Specification Summary for Package: chat

Summary: Server based chat with an html and ajax client.
Description: Adapted by Peter Alberer 2006/03/25 to allow java and ajax to coexist. Adapted by Tekne 2006/03/01 to replace JAVA server with AJAX; make use of generalized chat class from xotcl-core. Adapted by Antonio Pisano circa 2016-2019 to reduce bloating and exploit xotcl ORM and server push capabilities. Java server was discontinued in the process. Adapted by Hector Romojaro Gomez 2018-2019 to give a modern look and feel, customizable skins and avatar picture.
Documentation: Package Documentation
Maturity: Mature
This package depends on: acs-kernel acs-tcl acs-templating xowiki
Packages that depend on chat: chat-includelet chat-portlet dotlrn-chat
Package parameters:
ChatSkin
Chat skin. Current options are 'classic', 'bubbles' and 'minimal'. (default bubbles, type string, scope instance)
LinkRegex
Regular expression to detect URLs in chat messages, creating html links accordingly. By default, it matches any string starting with http:// or https://. Please notice the backslash double escaping. (default (https?:\\/\\/[^\\s]+), type string, scope global)
UserColors
A list of colors to assign to usernames in the chat (default #006400 #0000ff #b8860b #bdb76b #8b0000, type string, scope instance)


Bug Tracker Summary for Package: chat

Open Bugs: 1
All Tracked Issues: 5
Latest Bug Opened: 2006-04-05 Ajax chat English language catalog incomplete
Latest Bug Fixed: 2015-07-25 Russian localization for package chat(HEAD).
Top Bug Submitters: Ryan Gallimore (3) Joel Aufrecht (1) Vlad V (1)
Top Bug Fixers: Gustaf Neumann (4)


Code Metrics Summary for Package: chat

# Tcl Procs 26
# Tcl Lines 1079
# Tcl Blank Lines 127
# Tcl Comment Lines 67
# Automated Tests 0
# Stored Procedures PG: 0 ORA: 0
# SQL Lines PG: 65 (blank 12 comments 12) ORA: 69 (blank 12 comments 12)
# ADP pages 17
# ADP lines 340
# Include pages (chat/lib/) 3
# Documentation pages 0 (Package Documentation)
# Documentation lines 0
Browse Source API-browser
Github Repository: https://github.com/openacs/chat/tree/oacs-5-10

 

The chat package is currently using two different chat engines:

  1. The Java applet and the Java chat server, or
  2. the Ajax based chat class from xotcl-core

If no xotcl-core is installed, one can only use the version with Java applet. If xotcl-core is installed, one has to option to choose between both engines via parameter.

In essence, the Ajax based variant is the chat implementation from xowiki plus chat room management and a list of the currently connected users. Originally, the AJAX-based chat class (::xo::Chat) was developed for xowiki, but later moved to xotcl-core such that the chat package does not need a dependency on xotcl-core and xowiki.

Actually, the chat support in xowiki contains a different variety of AJAX based communication strategies:

  1. Polling mode (the web browser queries via AJAX in definable intervals the server, and checks, if there is some new information available), and
  2. Streaming mode (the client opens a connection to the server, the server pushes the information back to the client. xowiki chat supports two different sub-modes:
    1. streaming of JSON objects via asynchronous AJAX sockets, or
    2. scripted streaming, where the browser loads HTML with embedded script tags in the background from a hidden iframe

Both (2a) and (2b) require libthread installed and NaviServer. However, the advantage of the streaming approaches is that they are much faster in the look and feel and that they are better scalable on sites with a high load. 2a works only on Firefox (not in current versions of IE or Safari) and has the advantage over 2b that the browser does not show the background activity (no spinning wheel in Firefox). 2b is more robust and works with Safari, IE and Firefox (the information about the browser support is from 2006, and most probably different today). Both streaming modes implement, what is sometimes called COMET.

 

When the chat package uses the ::xo::Chat, it uses it only in currently only polling mode, which has the least requirements. This has been as well tested with (Firefox, IE and Safari).

 

 

 

 

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

 

 

previous October 2024
Sun Mon Tue Wed Thu Fri Sat
29 30 1 (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

Popular tags

17 , 5.10 , 5.10.0 , 5.10.1 , 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
No registered users in community xowiki
in last 30 minutes
Contributors

OpenACS.org