You are not logged in.
FPC version 3.0.0 "Pestering Peacock" has been released!
Can someone confirm that FPC RTTI branch is included?
Don't like ZDBC transaction management. Always keep started transaction on server even if nobody is connected.
http://synopse.info/forum/viewtopic.php … 105#p14105
Is SynDBFirebird.pas develop any more. I can't find any test.
What is missing to be production ready?
For http server investigate MS .Net server for Linux and Darwin https://github.com/aspnet/KestrelHttpServer
Based on libuv (core of node.js)
I look the code at https://github.com/aspnet/KestrelHttpSe … Networking
and try to port to pascal
@EgonHugeist
Trace1.zip with Delphi2007, http://synopse.info/files/mORMotNightlyBuild.zip inside is folder mORMot_and_Open_Source_friends_2014-12-12_205233_dec5dae65c and Zeos trunk (my mistake).
Today I use mORMot from git https://github.com/synopse/mORMot.git, last commit 17.12.2014 and Zeos testing-7.2 from svn.
With testing-7.2 hard_commit=true working, no more server crash.
aProps := TSQLDBZEOSConnectionProperties.Create('zdbc:firebird-2.5://Tomi-PC1:3253/d:\test\test.fdb?username=sysdba;password=masterkey;LibLocation=fbclient.dll;hard_commit=true','','','');This is new trace log with and without hard_commit.
http://halkyon.com/download/Trace23.zip
With hard_commit=true you can see that transaction is started in prev request and commited in current.
I expect no active transaction on server if nobody is connected. We can keep Connection open, but no active transaction.
For trace I use IBExpert, menu Trace and audit, copy/paste grid to LibreOffice.
Thanks for all
Sorry for delay answer. This is more Zeoslib problem in transaction management.
For confirmation this is trace log for "28 - Simple RESTful ORM Server" from today mORMotNightlyBuild and today Zeoslib svn, only changes in server is:
SynDBZEOS,
// SynDBODBC, // external DB access via ODBC
...
aProps := TSQLDBZEOSConnectionProperties.Create('zdbc:firebird-2.5://Tomi-PC1:3025/c:\test\test.fdb?username=sysdba;password=masterkey;LibLocation=fbclient.dll','','','');
// aProps := TODBCConnectionProperties.Create('','Driver=PostgreSQL Unicode'+
// {$ifdef CPU64}'(x64)'+{$endif}';Database=postgres;'+
// 'Server=localhost;Port=5432;UID=postgres;Pwd=postgresPassword','','');Firebird trace for start server, 3 times start client, stop server can be downloaded from:
http://halkyon.com/download/Trace1.zip
Look for Transaction ID column.
Ex. In start2 select from person is executed in transaction 12 and in same transaction is executed insert from start3.
Commit retaining on firebird server side is = to commit + start new transaction.
Also notice that transaction 9 and statement 44 is keep open to the end of server process. Do we need this open connection, transaction, statement (cursor)?
With "hard_commit=true" server crash on start no active transaction is started.
Another bad behavior of ZeosDBO is Auto start of transaction. If you use connection pool you will have shifting of transaction logic, transaction is started in previous Unit of work and commited in current
Unit of work1
// transaction is started in Unit of work 0
Exec Statement11
Exec Statement12
Commit Transaction 1
Start Transaction 2
Unit of work2
// transaction is started in Unit of work 1 (Start Transaction 2)
Exec Statement21
Exec Statement22
Commit Transaction 2
Start Transaction 3If for some reason Unit of work 1 don't commit or rollback Transaction 1, Commit Transaction 2 in Unit of work 2 will commit Exec Statement11, Exec Statement12 from Unit of work1. I expect:
Unit of work N
Start Transaction N
Exec StatementN1
Exec StatementN2
Commit Transaction NThis behavior can be confirmed with monitoring (trace) FB server.
In fact, in mORMot ORM we propose the TSQLRestBatch mode which implements the "Unit of Work" pattern, and is faster and using less resource than explicit SQL level transactions.
Do you test speed? For PostgreSQL auto commit work on server side with inserting begin and commit for every statements.
If you send
INSERT 1
INSERT 2
INSERT N
server will convert to
BEGIN
INSERT 1
COMMIT
BEGIN
INSERT 2
COMMIT
BEGIN
INSERT N
COMMIT
If you use explicit SQL level transaction in "Unit of Work"
BEGIN
INSERT 1
INSERT 2
INSERT N
COMMIT
No conversion on server side, also speed will increase
BTW I suspect the "explicit COMMIT" needed by FB when AutoCommit is TRUE is why ZDBC is slower than FireDAC for single INSERT operations.
In fact, one TSQLRest.Add() operation would need to perform two statements each time, i.e. INSERT + COMMIT, so it is slower than a direct auto-committed INSERT.
Perhaps we may be able to tune it for FB or at least for PostgreSQL, which support an "auto-commit" mode.
ZDBC and FireDAC use same client api fbclient.dll. Auto Commit is software emulated by ZDBC and FireDAC. In firebird API you must at minimum start transaction, execute statement and commit transaction. This is minimum 3 network request/response to Firebird server. Commit is not a statement in firebird api (yes it is network request to server). ZDBC is slower then FireDAC because of bad implementation of api or maybe FireDAC don't commit all data in time (commiting data on disconnect)
Firebird transaction management is a future not limitation.
Every execute statement is executed in transaction.
Transaction<>DB Connection
Firebird can use nested transactions, PostgrSQL, MSSql, Oracle can not, to simulate you must to use another connection.
Example (pseudo code):
Db1 fb1.fdb
Trans1 Start Transaction
Exec1(Db1, Trans1, 'some statement');
Trans2 Start Transaction
Exec2(Db1, Trans2, 'some other');
Trans2 Commit
Exec3(Db1, Trans1, 'some other statement');
Trans1 CommitTrans1 and Trans2 can use different isolation level
Transactions can be multi database (Double Commit)
Example:
Db1 fb1.fdb
Db2 fb2.fdb
TransMulti.Add(Db1)
TransMulti.Add(Db2)
TransMulti start transaction
Exec1(Db1, TransMulti, 'some statement in db1')
Exec2(Db2, TransMulti, 'some statement in db2')
TransMulti Commit // Double Commit in both db1 and db2Very useful future for replications, datapump, etc
I don't know if this future can be used in mORMot, maybe in user made services.
For RESTful services you can use (resuse) same Fb connection (connect/disconnect can cost time), but every Rest action must start transaction and commit or rollback in the end.
PK ID is big restriction to use mORMot to migrate my systems.
1. My POS system Ex. 1 Central office and 20 POS locations (1 central db and 20 remote db), every POS location have 1-20 clients (sales point). POS locations must work even if internet connection VPN is lost. My PK is ID_LOCATION, ID
2. My accounting system, 1 Accounting office have >100 customers, some customers replicate data to accounting office. My PK is ID_USER, ID
ID already contain fiscal year bit shift ex. 140000001 for 2014
ERP system in development SaaS is also planed with PK ID_USER, ID. Several customers will use same database as storage. Some performance test for 1000 customers confirm that it is best to have 10 database with 100 customers per db instead of 1000 db-s.
Db-s Firebird and PostgreSQL.
"Since lNet does support IOCP"
My mistake. Windows use select, will be nice to implement IOCP/http.sys.
http://bugs.freepascal.org/view.php?id=23475
AB, G-Wan was active developed in 2012 and performance tests was questionable in the forum. After that forum was closed and deleted. The last version is from Mar 14 2013. It looks nice but don't have marked share. Core is epoll linux kernel lib.
libuv core of node.js is c++ tcp, multithreding, signalig lib, use IOCP in win and epoll on linux. Not easy to use in pascal.
Do you try lNet library?
http://lnet.wordpress.com/
Use IOCP in windows, epoll in linux and Qevent in BSD.
You can test small http server, great performance on linux. Try sample source from svn repo.
Need some work in multithreding and polishing. lthreadevents.pp have some work for worker threads.
Open Source, FreePascal, my vote.